From cae44bcbba22ec858340e00f687213633d5e5134 Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Wed, 21 Jun 2017 11:06:33 +0200 Subject: [PATCH 1/2] Add Barcelona location seed --- .../Infrastructure/LocationsContextSeed.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs b/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs index 05acfe0b8..b26054d35 100644 --- a/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs +++ b/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs @@ -24,6 +24,7 @@ { await SetIndexes(); await SetUSLocations(); + await SetBarcelonaLocations(); } } @@ -81,6 +82,20 @@ await ctx.Locations.InsertOneAsync(rdm); } + static async Task SetBarcelonaLocations() + { + var bcn = new Locations() + { + Code = "BCN", + Description = "Barcelona", + LocationId = 5 + }; + bcn.SetLocation(2.156453, 41.395226); + bcn.SetArea(GetBarcelonaPoligon()); + await ctx.Locations.InsertOneAsync(bcn); + } + + static async Task SetIndexes() { // Set location indexes @@ -141,5 +156,17 @@ new GeoJson2DGeographicCoordinates(-124.68633, 48.8943) }; } + + static List GetBarcelonaPoligon() + { + return new List() + { + new GeoJson2DGeographicCoordinates(2.113741, 41.419068), + new GeoJson2DGeographicCoordinates(2.188778, 41.451153), + new GeoJson2DGeographicCoordinates(2.235266, 41.418033), + new GeoJson2DGeographicCoordinates(2.137101, 41.299536), + new GeoJson2DGeographicCoordinates(2.033879, 41.383858) + }; + } } } From 123cd9e1c1453816ec5d2b0298515b568fb71d35 Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Wed, 21 Jun 2017 11:47:34 +0200 Subject: [PATCH 2/2] Add point of union from the polygon --- .../Locations.API/Infrastructure/LocationsContextSeed.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs b/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs index b26054d35..ab163d98d 100644 --- a/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs +++ b/src/Services/Location/Locations.API/Infrastructure/LocationsContextSeed.cs @@ -161,6 +161,7 @@ { return new List() { + new GeoJson2DGeographicCoordinates(2.033879, 41.383858), new GeoJson2DGeographicCoordinates(2.113741, 41.419068), new GeoJson2DGeographicCoordinates(2.188778, 41.451153), new GeoJson2DGeographicCoordinates(2.235266, 41.418033),