public static JGeometry.Polygon Polygon2JG(SimplePolygon simplePolygon)
        {
            var rings = (from ring in simplePolygon.rings select Polyline2JG(ring)).ToList();

            JGeometry.Polygon polygon = new JGeometry.Polygon(rings);
            return(polygon);
        }
        public void FeatureSerialization()
        {
            var coordinates = new[]
            {
                new List<IPosition>
                {
                    new GeographicPosition(52.370725881211314, 4.889259338378906),
                    new GeographicPosition(52.3711451105601, 4.895267486572266),
                    new GeographicPosition(52.36931095278263, 4.892091751098633),
                    new GeographicPosition(52.370725881211314, 4.889259338378906)
                },
                new List<IPosition>
                {
                    new GeographicPosition(52.370725881211314, 4.989259338378906),
                    new GeographicPosition(52.3711451105601, 4.995267486572266),
                    new GeographicPosition(52.36931095278263, 4.992091751098633),
                    new GeographicPosition(52.370725881211314, 4.989259338378906)
                },
            };

            var settings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
            IGeometryObject geometry;

            geometry = new LineString(coordinates[0]);
            JsonAssert.AssertCoordinates(JsonConvert.SerializeObject(new Feature.Feature(geometry), DefaultJsonSerializerSettings), 1, coordinates[0]);

            geometry = new Point(coordinates[0][0]);
            JsonAssert.AssertCoordinates(JsonConvert.SerializeObject(new Feature.Feature(geometry), DefaultJsonSerializerSettings), 0, coordinates[0].Take(1).ToArray());

            geometry = new MultiLineString(coordinates.Select(ca => new LineString(ca)).ToList());
            JsonAssert.AssertCoordinates(JsonConvert.SerializeObject(new Feature.Feature(geometry), DefaultJsonSerializerSettings), 2, coordinates);

            geometry = new Polygon(coordinates.Select(ca => new LineString(ca)).ToList());
            JsonAssert.AssertCoordinates(JsonConvert.SerializeObject(new Feature.Feature(geometry), DefaultJsonSerializerSettings), 2, coordinates);
        }
Example #3
0
        private async Task GetPolygonData()
        {
            var country = await _dbContext.Countries.FirstOrDefaultAsync();

            //Geometry to geoJSON
            var lines               = new List <GeoJSON.Net.Geometry.LineString>();
            var polygon             = country.Border as NetTopologySuite.Geometries.Polygon;
            List <Coordinate[]> res = new List <Coordinate[]>();

            res.Add(polygon.Shell.Coordinates);
            foreach (ILineString interiorRing in polygon.InteriorRings)
            {
                res.Add(interiorRing.Coordinates);
            }
            foreach (var line in res)
            {
                var coordinates = new List <IPosition>();
                foreach (var item in line)
                {
                    coordinates.Add(new Position(item.X, item.Y, item.Z));
                }
                lines.Add(new GeoJSON.Net.Geometry.LineString(coordinates));
            }
            GeoJSON.Net.Geometry.Polygon jsonPolygon = new GeoJSON.Net.Geometry.Polygon(lines);
            var s = JsonConvert.SerializeObject(jsonPolygon);
            //Geometry to wkt
            var writer = new NetTopologySuite.IO.WKTWriter();
            var s2     = writer.Write(country.Border);

            Console.WriteLine($"GeoJSON结果:{s},WKT结果:{s2}");
        }
Example #4
0
        private PolygonOptions GeoJsonPolygonToPolygon(GPolygon geoJsonPolygon)
        {
            System.Collections.ObjectModel.ReadOnlyCollection <LineString> coords = geoJsonPolygon?.Coordinates;
            if (coords == null || coords.Count() == 0)
            {
                return(null);
            }

            PolygonOptions polygonOptions = GetPolygonOptions();

            LineString outer = coords.FirstOrDefault();
            IEnumerable <LineString> inner = coords.Count > 1 ? coords.Skip(1) : null;

            foreach (IPosition coordinate in outer.Coordinates)
            {
                polygonOptions.Add(new LatLng(coordinate.Latitude, coordinate.Longitude));
            }

            if (inner != null)
            {
                foreach (LineString linestring in inner)
                {
                    var holes = linestring.Coordinates.Select(coordinate => new LatLng(coordinate.Latitude, coordinate.Longitude)).ToList();
                    polygonOptions.Holes.Add(holes.ToJavaList());
                }
            }

            return(polygonOptions);
        }
Example #5
0
        private void OnPolygonClick(object sender, GoogleMap.PolygonClickEventArgs e)
        {
            //Do things

            GPolygon geoPolygon = _polygons.FirstOrDefault(p => p.Value.Id == e.Polygon.Id).Key;

            if (geoPolygon == null)
            {
                return;
            }
        }
Example #6
0
        private static LevrumPolygon getLevrumPolygon(GeoJSONPolygon input)
        {
            LevrumPolygon output = new LevrumPolygon();

            foreach (LineString lineStr in input.Coordinates)
            {
                foreach (IPosition position in lineStr.Coordinates)
                {
                    output.AddPoint(position.Longitude, position.Latitude);
                }
            }

            return(output);
        }
Example #7
0
        private MapPolygon GeoJsonPolygonToMapPolygon(Polygon geoJsonPolygon)
        {
            var outer = geoJsonPolygon?.Coordinates.FirstOrDefault();

            if (outer != null)
            {
                var polygon = new MapPolygon(
                    outer.Coordinates
                    .Select(point => new Position(point.Latitude, point.Longitude)).ToArray());
                return(polygon);
            }

            return(null);
        }
Example #8
0
        private void DrawPolygon(IDisplay display, GeoJSON.Net.Geometry.Polygon poly, ISpatialReference sr)
        {
            var linestrings = poly.Coordinates[0];
            var polyAo      = GetAoPolygon(linestrings, sr);

            polyAo.SpatialReference = sr;

            if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != SpatialReference.FactoryCode)
            {
                polyAo.Project(m_mapSpatialRef);
            }

            display.DrawPolygon(polyAo);
        }
Example #9
0
        public static string ConvertPolygonToGeoJSON(LevrumPolygon polygon)
        {
            List <IPosition> positions = new List <IPosition>();

            foreach (Point2 point in polygon.Points)
            {
                positions.Add(new Position(point.Y, point.X));
            }
            LineString        lineStr = new LineString(positions);
            List <LineString> list    = new List <LineString>();

            list.Add(lineStr);
            GeoJSONPolygon poly = new GeoJSONPolygon(list);

            return(JsonConvert.SerializeObject(poly));
        }
        public void PolygonFeatureSerialization()
        {
            var coordinates = new List<GeographicPosition>
            {
                new GeographicPosition(52.370725881211314, 4.889259338378906),
                new GeographicPosition(52.3711451105601, 4.895267486572266),
                new GeographicPosition(52.36931095278263, 4.892091751098633),
                new GeographicPosition(52.370725881211314, 4.889259338378906)
            };

            var polygon = new Polygon(new List<LineString> { new LineString(coordinates) });
            var featureProperties = new Dictionary<string, object> { { "Name", "Foo" } };
            var model = new Feature.Feature(polygon, featureProperties);

            var serializedData = JsonConvert.SerializeObject(model);
        }
Example #11
0
        /// <summary>
        /// closes any rings
        /// </summary>
        /// <param name="points"></param>
        public PolygonBuilder(List<IPosition> outerRingPoints)
        {
            if (outerRingPoints.Count <= 3)
                throw new ArgumentException("Must have more than 2 points for a polygon", "points");

            LineString ring = new LineString(outerRingPoints);

            if (!ring.IsClosed())
                ring.Coordinates.Add(ring.Coordinates[0]);

            List<LineString> lines = new List<LineString>();

            lines.Add(ring);
            
            _polygon = new Polygon(lines);

        }
Example #12
0
        public static LevrumPolygon[] ConvertRegionToPolygons(string geoJSON)
        {
            List <LevrumPolygon> output = new List <LevrumPolygon>();

            try
            {
                ProtoGeoJSON obj = JsonConvert.DeserializeObject <ProtoGeoJSON>(geoJSON);

                switch (obj.Type)
                {
                case "FeatureCollection":
                    FeatureCollection features = JsonConvert.DeserializeObject <FeatureCollection>(geoJSON);
                    foreach (Feature subFeature in features.Features)
                    {
                        output.AddRange(getLevrumPolygonsFromFeature(subFeature));
                    }
                    break;

                case "Feature":
                    Feature feature = JsonConvert.DeserializeObject <Feature>(geoJSON);
                    output.AddRange(getLevrumPolygonsFromFeature(feature));
                    break;

                case "MultiPolygon":
                    MultiPolygon multiPolygon = JsonConvert.DeserializeObject <MultiPolygon>(geoJSON);
                    foreach (GeoJSONPolygon subPolygon in multiPolygon.Coordinates)
                    {
                        output.Add(getLevrumPolygon(subPolygon));
                    }
                    break;

                case "Polygon":
                    GeoJSONPolygon polygon = JsonConvert.DeserializeObject <GeoJSONPolygon>(geoJSON);
                    output.Add(getLevrumPolygon(polygon));
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
            }

            return(output.ToArray());
        }
Example #13
0
        public void PolygonFeatureSerialization() 
        {
            var coordinates = new List<GeographicPosition> 
                { 
                    new GeographicPosition(52.370725881211314, 4.889259338378906), 
                    new GeographicPosition(52.3711451105601, 4.895267486572266), 
                    new GeographicPosition(52.36931095278263, 4.892091751098633), 
                    new GeographicPosition(52.370725881211314, 4.889259338378906) 
                }.ToList<IPosition>();

            var polygon = new Polygon(new List<LineString> { new LineString(coordinates) });
            var featureProperties = new Dictionary<string, object> { { "Name", "Foo" } };
            var model = new GeoJSON.Net.Feature.Feature(polygon, featureProperties);

            var serializedData = JsonConvert.SerializeObject(model, Formatting.Indented, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), NullValueHandling = NullValueHandling.Ignore });

        }
Example #14
0
        private void AddPolygonGeometryToMap(GPolygon polygonGeometry)
        {
            PolygonOptions polygon = GeoJsonPolygonToPolygon(polygonGeometry);

            if (polygon != null)
            {
                try
                {
                    APolygon aPolygon = NativeMap.AddPolygon(polygon);
                    _polygons.Add(polygonGeometry, aPolygon);
                }
                catch (Exception)
                {
                    Console.WriteLine("Failed to add polygon to map or dictionary");
                }
            }
        }
Example #15
0
        public void Can_Serialize()
        {
            var polygon = new Polygon(new List<LineString>
            {
                new LineString(new List<GeographicPosition>
                {
                    new GeographicPosition(52.379790828551016, 5.3173828125),
                    new GeographicPosition(52.36721467920585, 5.456085205078125),
                    new GeographicPosition(52.303440474272755, 5.386047363281249, 4.23),
                    new GeographicPosition(52.379790828551016, 5.3173828125),
                })
            });

            var expectedJson = GetExpectedJson();
            var actualJson = JsonConvert.SerializeObject(polygon);

            JsonAssert.AreEqual(expectedJson, actualJson);
        }
        public void Can_Serialize()
        {
            // Arrang
            var polygon1 = new Polygon(new List<LineString>
            {
                new LineString(new List<GeographicPosition>
                {
                    new GeographicPosition(0, 0), 
                    new GeographicPosition(0, 1), 
                    new GeographicPosition(1, 1), 
                    new GeographicPosition(1, 0), 
                    new GeographicPosition(0, 0)
                })
            });

            var polygon2 = new Polygon(new List<LineString>
            {
                new LineString(new List<GeographicPosition>
                {
                    new GeographicPosition(100, 100), 
                    new GeographicPosition(100, 101), 
                    new GeographicPosition(101, 101), 
                    new GeographicPosition(101, 100), 
                    new GeographicPosition(100, 100)
                }), 
                new LineString(new List<GeographicPosition>
                {
                    new GeographicPosition(200, 200), 
                    new GeographicPosition(200, 201), 
                    new GeographicPosition(201, 201), 
                    new GeographicPosition(201, 200), 
                    new GeographicPosition(200, 200)
                })
            });

            var multiPolygon = new MultiPolygon(new List<Polygon> { polygon1, polygon2 });
            var expectedJson = GetExpectedJson();

            // Act
            var actualJson = JsonConvert.SerializeObject(multiPolygon);

            // Assert
            JsonAssert.AreEqual(expectedJson, actualJson);
        }
        public static Feature Parse(Tile.Feature feature, List<string> keys, List<Tile.Value> values, int x, int y, int z, uint extent, bool convertToGeographicPosition)
        {
            Feature result = null;
            var geom = GeometryParser.ParseGeometry(feature.Geometry, feature.Type);
            var id = feature.Id;

            var positions= convertToGeographicPosition?
                geom.Select(p => p.ToGeographicPosition(x,y,z,extent)).ToList():
                geom.Select(p => new GeographicPosition(p.Latitude, p.Longitude)).ToList();

            var coordinates = positions.ToList<IPosition>();
            if (feature.Type == Tile.GeomType.Polygon)
            {
                if (coordinates.Count > 3)
                {
                    var polygon = new Polygon(new List<LineString> {new LineString(coordinates)});
                    result = new Feature(polygon);
                }
            }
            else if (feature.Type == Tile.GeomType.LineString)
            {
                var ls = new LineString(coordinates);
                result = new Feature(ls);
            }
            else if (feature.Type == Tile.GeomType.Point)
            {
                var pt = new Point(coordinates[0]);
                result = new Feature(pt);

            }

            if (result != null)
            {
                result.Id = id.ToString(CultureInfo.InvariantCulture);
                var attributes = AttributesParser.Parse(keys, values, feature.Tags);
                foreach (var item in attributes)
                {
                    result.Properties.Add(item.Key, item.Value);
                }

            }
            return result;
        }
        public static AgGateway.ADAPT.ApplicationDataModel.Shapes.Polygon MapPolygon(GeoJSON.Net.Geometry.Polygon polygonGeoJson, AffineTransformation affineTransformation = null)
        {
            var polygon = new AgGateway.ADAPT.ApplicationDataModel.Shapes.Polygon();

            // First LineString is ExteriorRing, see https://tools.ietf.org/html/rfc7946#section-3.1.6
            for (int i = 0; i < polygonGeoJson.Coordinates.Count; i++)
            {
                if (i == 0)
                {
                    polygon.ExteriorRing = LineStringMapper.MapLineString(polygonGeoJson.Coordinates[i], affineTransformation);
                }
                else
                {
                    polygon.InteriorRings.Add(LineStringMapper.MapLineString(polygonGeoJson.Coordinates[i], affineTransformation));
                }
            }

            return(polygon);
        }
Example #19
0
        public IActionResult GetPolygon(int countryId)
        {
            var country = _dbContext.Countries.FirstOrDefault(x => x.CountryID == countryId);

            if (country == null)
            {
                return(Json($"查询不到id为{countryId}的国家"));
            }

            //Geometry to GeoJSON
            //https://nettopologysuite.github.io/html/class_net_topology_suite_1_1_geometries_1_1_polygon.html
            //https://github.com/synhershko/nettopologysuite/blob/master/NetTopologySuite.IO/NetTopologySuite.IO.GeoJSON/Converters/GeometryConverter.cs
            //->已copy到GeometryConverter和GeometryArrayConverter
            var lines               = new List <GeoJSON.Net.Geometry.LineString>();
            var polygon             = country.Border as NetTopologySuite.Geometries.Polygon;
            List <Coordinate[]> res = new List <Coordinate[]>();

            res.Add(polygon.Shell.Coordinates);
            foreach (ILineString interiorRing in polygon.InteriorRings)
            {
                res.Add(interiorRing.Coordinates);
            }
            foreach (var line in res)
            {
                var coordinates = new List <IPosition>();
                foreach (var item in line)
                {
                    coordinates.Add(new Position(item.X, item.Y, item.Z));
                }
                lines.Add(new GeoJSON.Net.Geometry.LineString(coordinates));
            }
            GeoJSON.Net.Geometry.Polygon jsonPolygon = new GeoJSON.Net.Geometry.Polygon(lines);
            var s = JsonConvert.SerializeObject(jsonPolygon);
            //Geometry to wkt
            //点和线的是静态方法,面的是方法_(:з」∠)_
            var writer = new NetTopologySuite.IO.WKTWriter();
            var s2     = writer.Write(country.Border);

            return(Json($"GeoJSON结果:{s},WKT结果:{s2}"));
        }
        public void PolygonSerialization()
        {
            var coordinates = new List<GeographicPosition> 
                { 
                    new GeographicPosition(52.370725881211314, 4.889259338378906), 
                    new GeographicPosition(52.3711451105601, 4.895267486572266), 
                    new GeographicPosition(52.36931095278263, 4.892091751098633), 
                    new GeographicPosition(52.370725881211314, 4.889259338378906) 
                }.ToList<IPosition>();

            var model = new Polygon(new List<LineString> { new LineString(coordinates) });
            var serializedData = JsonConvert.SerializeObject(model, Formatting.Indented, DefaultJsonSerializerSettings);

            var matches = Regex.Matches(serializedData, @"(?<coordinates>[0-9]+([.,][0-9]+))");

            double lng;
            double.TryParse(matches[0].Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out lng);

            //Double precision can pose a problem 
            Assert.IsTrue(Math.Abs(lng - 4.889259338378906) < 0.0000001);
            Assert.IsTrue(!serializedData.Contains("latitude"));
        }
Example #21
0
        public void ComparePolygons()
        {
            var coordinates = new List<GeographicPosition> 
                { 
                    new GeographicPosition(52.370725881211314, 4.889259338378906), 
                    new GeographicPosition(52.3711451105601, 4.895267486572266), 
                    new GeographicPosition(52.36931095278263, 4.892091751098633), 
                    new GeographicPosition(52.370725881211314, 4.889259338378906) 
                }.ToList<IPosition>();

            var coordinates2 = new List<GeographicPosition> 
                { 
                    new GeographicPosition(52.370725881211314, 4.889259338378906), 
                    new GeographicPosition(52.3711451105601, 4.895267486572266), 
                    new GeographicPosition(52.36931095278263, 4.892091751098633), 
                    new GeographicPosition(52.370725881211314, 4.889259338378906) 
                }.ToList<IPosition>();

            var polygon = new Polygon(new List<LineString> { new LineString(coordinates) });
            var polygon2 = new Polygon(new List<LineString> { new LineString(coordinates2) });

            Assert.IsTrue(polygon == polygon2);

            var coordinates3 = new List<GeographicPosition> 
                { 
                    new GeographicPosition(52.3707258811314, 4.889259338378906), 
                    new GeographicPosition(52.3711451105601, 4.895267486572266), 
                    new GeographicPosition(52.362095278263, 4.892091751098633), 
                    new GeographicPosition(52.3707258811314, 4.889259338378906) 
                }.ToList<IPosition>();
            var polygon3 = new Polygon(new List<LineString> { new LineString(coordinates3) });
            Assert.IsFalse(polygon == polygon3);


            polygon.Coordinates[0].Coordinates.Add(new GeographicPosition(52.370725881211314, 4.889259338378906));
            Assert.IsFalse(polygon == polygon2);

        }
Example #22
0
        public void Can_Deserialize_With_Exterior_And_Inner_Rings()
        {
            var json = GetExpectedJson();

            var expectedPolygon = new Polygon(new List<LineString>
            {
                new LineString(new List<IPosition>
                {
                    new GeographicPosition(34.9895035675793, -84.3228149414063),
                    new GeographicPosition(35.2198194079344, -84.2912292480469),
                    new GeographicPosition(35.2545909746502, -84.2404174804688),
                    new GeographicPosition(35.2669256889501, -84.2253112792969),
                    new GeographicPosition(35.2658044288675, -84.2074584960938),
                    new GeographicPosition(35.24674063356, -84.19921875),
                    new GeographicPosition(35.2411327816664, -84.1621398925781),
                    new GeographicPosition(35.2489836657264, -84.1236877441406),
                    new GeographicPosition(35.2489836657264, -84.0907287597656),
                    new GeographicPosition(35.2646831532681, -84.0879821777344),
                    new GeographicPosition(35.2770163313988, -84.0426635742188),
                    new GeographicPosition(35.2915894845661, -84.0303039550781),
                    new GeographicPosition(35.3061600145508, -84.0234375),
                    new GeographicPosition(35.3274506849288, -84.0330505371094),
                    new GeographicPosition(35.3431349602819, -84.0357971191406),
                    new GeographicPosition(35.3487357494725, -84.0357971191406),
                    new GeographicPosition(35.3554561839208, -84.0165710449219),
                    new GeographicPosition(35.3733746083496, -84.0110778808594),
                    new GeographicPosition(35.3912890552176, -84.0097045898437),
                    new GeographicPosition(35.4147957290186, -84.0193176269531),
                    new GeographicPosition(35.4293440441072, -84.0028381347656),
                    new GeographicPosition(35.4740916077303, -83.9369201660156),
                    new GeographicPosition(35.4763283326573, -83.9122009277344),
                    new GeographicPosition(35.5042821432997, -83.8888549804688),
                    new GeographicPosition(35.5165787389029, -83.8847351074219),
                    new GeographicPosition(35.5210497612994, -83.8751220703125),
                    new GeographicPosition(35.5210497612994, -83.8531494140625),
                    new GeographicPosition(35.5210497612994, -83.8284301757813),
                    new GeographicPosition(35.5344613341844, -83.8092041015625),
                    new GeographicPosition(35.5411662799981, -83.8023376464844),
                    new GeographicPosition(35.5623949105885, -83.7680053710937),
                    new GeographicPosition(35.5623949105885, -83.7432861328125),
                    new GeographicPosition(35.5623949105885, -83.7199401855469),
                    new GeographicPosition(35.5690975207761, -83.6705017089844),
                    new GeographicPosition(35.570214567966, -83.6334228515625),
                    new GeographicPosition(35.5769165240386, -83.6100769042969),
                    new GeographicPosition(35.5746826009809, -83.5963439941406),
                    new GeographicPosition(35.559043395259, -83.5894775390625),
                    new GeographicPosition(35.5657462857628, -83.5523986816406),
                    new GeographicPosition(35.5635120512197, -83.4974670410156),
                    new GeographicPosition(35.5869684067865, -83.4700012207031),
                    new GeographicPosition(35.6081849043775, -83.4466552734375),
                    new GeographicPosition(35.6360927786314, -83.3793640136719),
                    new GeographicPosition(35.6561804163202, -83.3573913574219),
                    new GeographicPosition(35.6662223410348, -83.3230590820312),
                    new GeographicPosition(35.6539487059976, -83.3148193359375),
                    new GeographicPosition(35.6606436498816, -83.2997131347656),
                    new GeographicPosition(35.6718006423877, -83.2859802246094),
                    new GeographicPosition(35.6907639509368, -83.2612609863281),
                    new GeographicPosition(35.699686301252, -83.2571411132813),
                    new GeographicPosition(35.7152980121253, -83.2557678222656),
                    new GeographicPosition(35.7231027209226, -83.2351684570313),
                    new GeographicPosition(35.727562211272, -83.1980895996094),
                    new GeographicPosition(35.7531994355703, -83.1623840332031),
                    new GeographicPosition(35.763229145499, -83.1582641601563),
                    new GeographicPosition(35.7699149163548, -83.1033325195313),
                    new GeographicPosition(35.7843988251953, -83.0868530273438),
                    new GeographicPosition(35.7877408909866, -83.0511474609375),
                    new GeographicPosition(35.7832847720374, -83.0168151855469),
                    new GeographicPosition(35.7788284032737, -83.001708984375),
                    new GeographicPosition(35.7933106883517, -82.9673767089844),
                    new GeographicPosition(35.820040281161, -82.9454040527344),
                    new GeographicPosition(35.8512134345006, -82.9193115234375),
                    new GeographicPosition(35.869021165017, -82.9083251953125),
                    new GeographicPosition(35.8779235299512, -82.9055786132813),
                    new GeographicPosition(35.9235324471824, -82.9124450683594),
                    new GeographicPosition(35.9468829321814, -82.8836059570313),
                    new GeographicPosition(35.9513298615227, -82.8561401367188),
                    new GeographicPosition(35.9424357525543, -82.8424072265625),
                    new GeographicPosition(35.924644531441, -82.825927734375),
                    new GeographicPosition(35.9279806903827, -82.8067016601563),
                    new GeographicPosition(35.9424357525543, -82.8053283691406),
                    new GeographicPosition(35.9735607534962, -82.7792358398438),
                    new GeographicPosition(35.9924520905583, -82.7806091308594),
                    new GeographicPosition(36.0035625289507, -82.7613830566406),
                    new GeographicPosition(36.0446575392153, -82.6954650878906),
                    new GeographicPosition(36.0602014123929, -82.6446533203125),
                    new GeographicPosition(36.0602014123929, -82.6130676269531),
                    new GeographicPosition(36.0335528934004, -82.606201171875),
                    new GeographicPosition(35.9913409606354, -82.606201171875),
                    new GeographicPosition(35.979117498575, -82.606201171875),
                    new GeographicPosition(35.9613345373669, -82.5787353515625),
                    new GeographicPosition(35.9513298615227, -82.5677490234375),
                    new GeographicPosition(35.9724493575368, -82.5306701660156),
                    new GeographicPosition(36.0068953552447, -82.4647521972656),
                    new GeographicPosition(36.0701922812085, -82.4166870117188),
                    new GeographicPosition(36.1012668692145, -82.3796081542969),
                    new GeographicPosition(36.1179089165637, -82.3548889160156),
                    new GeographicPosition(36.1134713820522, -82.3411560058594),
                    new GeographicPosition(36.1334383124587, -82.2958374023438),
                    new GeographicPosition(36.1356565467854, -82.2628784179687),
                    new GeographicPosition(36.1356565467854, -82.2340393066406),
                    new GeographicPosition(36.154509006695, -82.2216796875),
                    new GeographicPosition(36.1556178338186, -82.2038269042969),
                    new GeographicPosition(36.1445288570277, -82.1900939941406),
                    new GeographicPosition(36.1500735414076, -82.1543884277344),
                    new GeographicPosition(36.1345474374601, -82.1406555175781),
                    new GeographicPosition(36.116799556445, -82.1337890625),
                    new GeographicPosition(36.1057050932792, -82.1214294433594),
                    new GeographicPosition(36.1079241112865, -82.08984375),
                    new GeographicPosition(36.1267832332643, -82.0527648925781),
                    new GeographicPosition(36.1290016556965, -82.0362854003906),
                    new GeographicPosition(36.2940976837303, -81.9126892089844),
                    new GeographicPosition(36.3095921540914, -81.8907165527344),
                    new GeographicPosition(36.3350406720961, -81.8632507324219),
                    new GeographicPosition(36.344996525619, -81.8302917480469),
                    new GeographicPosition(36.3560570924018, -81.8014526367188),
                    new GeographicPosition(36.3461026530064, -81.7794799804687),
                    new GeographicPosition(36.3383594313405, -81.7616271972656),
                    new GeographicPosition(36.3383594313405, -81.7369079589844),
                    new GeographicPosition(36.3383594313405, -81.7190551757813),
                    new GeographicPosition(36.3350406720961, -81.7066955566406),
                    new GeographicPosition(36.3427842237072, -81.7066955566406),
                    new GeographicPosition(36.3571630626544, -81.7231750488281),
                    new GeographicPosition(36.379279167408, -81.7327880859375),
                    new GeographicPosition(36.4002836433235, -81.7369079589844),
                    new GeographicPosition(36.4135467039288, -81.7369079589844),
                    new GeographicPosition(36.4234925134723, -81.7245483398437),
                    new GeographicPosition(36.4455897517792, -81.7176818847656),
                    new GeographicPosition(36.4754110428296, -81.6984558105469),
                    new GeographicPosition(36.5107399414667, -81.6984558105469),
                    new GeographicPosition(36.5306053641136, -81.705322265625),
                    new GeographicPosition(36.55929085774, -81.6915893554688),
                    new GeographicPosition(36.5648060784035, -81.6806030273438),
                    new GeographicPosition(36.5868630234418, -81.6819763183594),
                    new GeographicPosition(36.5637030657692, -81.0420227050781),
                    new GeographicPosition(36.5614969932526, -80.7426452636719),
                    new GeographicPosition(36.540536162629, -79.8912048339844),
                    new GeographicPosition(36.5394328035512, -78.68408203125),
                    new GeographicPosition(36.540536162629, -77.8834533691406),
                    new GeographicPosition(36.5416395059613, -76.9166564941406),
                    new GeographicPosition(36.5504656857595, -76.9166564941406),
                    new GeographicPosition(36.551568887374, -76.31103515625),
                    new GeographicPosition(36.5493624683978, -75.7960510253906),
                    new GeographicPosition(36.075742215627, -75.6298828125),
                    new GeographicPosition(35.8222673411451, -75.4925537109375),
                    new GeographicPosition(35.6394410689739, -75.3936767578125),
                    new GeographicPosition(35.4382955473967, -75.41015625),
                    new GeographicPosition(35.2635618621521, -75.43212890625),
                    new GeographicPosition(35.187277675989, -75.487060546875),
                    new GeographicPosition(35.1738083179996, -75.5914306640625),
                    new GeographicPosition(35.0479867342673, -75.9210205078125),
                    new GeographicPosition(34.8679049625687, -76.17919921875),
                    new GeographicPosition(34.6286879737706, -76.4154052734375),
                    new GeographicPosition(34.5744295186527, -76.4593505859375),
                    new GeographicPosition(34.5337124213957, -76.53076171875),
                    new GeographicPosition(34.5518113691705, -76.5911865234375),
                    new GeographicPosition(34.6151266834622, -76.651611328125),
                    new GeographicPosition(34.6332079113796, -76.761474609375),
                    new GeographicPosition(34.5970415161442, -77.069091796875),
                    new GeographicPosition(34.4567480034781, -77.376708984375),
                    new GeographicPosition(34.3207552752374, -77.5909423828125),
                    new GeographicPosition(33.9798087287246, -77.8326416015625),
                    new GeographicPosition(33.8019735180659, -77.9150390625),
                    new GeographicPosition(33.7380448632891, -77.9754638671875),
                    new GeographicPosition(33.8521697014074, -78.11279296875),
                    new GeographicPosition(33.8521697014074, -78.2830810546875),
                    new GeographicPosition(33.8156663087028, -78.4808349609375),
                    new GeographicPosition(34.8047829195724, -79.6728515625),
                    new GeographicPosition(34.8363499907639, -80.782470703125),
                    new GeographicPosition(34.9174668892825, -80.782470703125),
                    new GeographicPosition(35.0929453137326, -80.9307861328125),
                    new GeographicPosition(35.0299963690257, -81.0516357421875),
                    new GeographicPosition(35.0524837066247, -81.0516357421875),
                    new GeographicPosition(35.1378791196342, -81.0516357421875),
                    new GeographicPosition(35.1962560078637, -82.3150634765625),
                    new GeographicPosition(35.1962560078637, -82.3590087890625),
                    new GeographicPosition(35.2231850497018, -82.4029541015625),
                    new GeographicPosition(35.1693180360113, -82.4688720703125),
                    new GeographicPosition(35.1154153142536, -82.6885986328125),
                    new GeographicPosition(35.0614769084972, -82.781982421875),
                    new GeographicPosition(35.0030033952767, -83.1060791015625),
                    new GeographicPosition(34.9985037001463, -83.616943359375),
                    new GeographicPosition(34.9850031301711, -84.056396484375),
                    new GeographicPosition(34.9850031301711, -84.22119140625),
                    new GeographicPosition(34.9895035675793, -84.3228149414063),
                }),
                new LineString(new List<IPosition>
                {
                    new GeographicPosition(35.7420538306804, -75.6903076171875),
                    new GeographicPosition(35.7420538306804, -75.5914306640625),
                    new GeographicPosition(35.5858515932324, -75.5419921875),
                    new GeographicPosition(35.3263302630748, -75.56396484375),
                    new GeographicPosition(35.2859847360657, -75.6903076171875),
                    new GeographicPosition(35.1648275060503, -75.970458984375),
                    new GeographicPosition(34.9940037575758, -76.2066650390625),
                    new GeographicPosition(35.0299963690257, -76.300048828125),
                    new GeographicPosition(35.0794603404798, -76.409912109375),
                    new GeographicPosition(35.1064280573642, -76.5252685546875),
                    new GeographicPosition(35.2590765425257, -76.4208984375),
                    new GeographicPosition(35.2949521474066, -76.3385009765625),
                    new GeographicPosition(35.2994354805454, -76.0858154296875),
                    new GeographicPosition(35.4427709258577, -75.948486328125),
                    new GeographicPosition(35.536696378395, -75.8660888671875),
                    new GeographicPosition(35.5679804580121, -75.772705078125),
                    new GeographicPosition(35.6349766506773, -75.706787109375),
                    new GeographicPosition(35.7420538306804, -75.706787109375),
                    new GeographicPosition(35.7420538306804, -75.6903076171875),
                })
            });

            var actualPolygon = JsonConvert.DeserializeObject<Polygon>(json);
            Assert.AreEqual(expectedPolygon, actualPolygon);
        }
		private static void Internal_FillGeographyBuilder(SqlGeographyBuilder gb, Polygon polygon)
		{
			gb.BeginGeography(OpenGisGeographyType.Polygon);
			bool isExteriorRing = true;
			foreach (var lineString in polygon.Coordinates)
			{
				List<GeographicPosition> listGeoCoords = lineString.Coordinates.Select(p => p as GeographicPosition).ToList();
				IEnumerable<GeographicPosition> orderedPositions = EnsureCorrectWinding(listGeoCoords, isExteriorRing); // exterior ring must be anti clockwise for SqlGeography
				isExteriorRing = false;
				bool beginFigureCalled = false;
				foreach (var pos in orderedPositions)
				{
					if (!beginFigureCalled)
					{
						gb.BeginFigure(pos.Latitude, pos.Longitude);
						beginFigureCalled = true;
					}
					else
					{
						gb.AddLine(pos.Latitude, pos.Longitude);
					}
				}
				gb.EndFigure();
			}
			gb.EndGeography();
		}
        public void MultiPolygonSerialization()
        {
            var expectedJson = "{\"geometry\":{\"coordinates\":[[[[0.0,0.0],[1.0,0.0],[1.0,1.0],[0.0,1.0],[0.0,0.0]]],[[[100.0,100.0],[101.0,100.0],[101.0,101.0],[100.0,101.0],[100.0,100.0]],[[200.0,200.0],[201.0,200.0],[201.0,201.0],[200.0,201.0],[200.0,200.0]]]],\"type\":\"MultiPolygon\"},\"properties\":{},\"type\":\"Feature\"}";
            var polygon1 = new Polygon(new List<LineString>
            {
                new LineString((new List<GeographicPosition>
                {
                    new GeographicPosition(0, 0),
                    new GeographicPosition(0, 1),
                    new GeographicPosition(1, 1),
                    new GeographicPosition(1, 0),
                    new GeographicPosition(0, 0)
                }).ToList<IPosition>())

            });

            var polygon2 = new Polygon(new List<LineString>
            {
                new LineString((new List<GeographicPosition>
                {
                    new GeographicPosition(100, 100),
                    new GeographicPosition(100, 101),
                    new GeographicPosition(101, 101),
                    new GeographicPosition(101, 100),
                    new GeographicPosition(100, 100)
                }).ToList<IPosition>()),
                new LineString((new List<GeographicPosition>
                {
                    new GeographicPosition(200, 200),
                    new GeographicPosition(200, 201),
                    new GeographicPosition(201, 201),
                    new GeographicPosition(201, 200),
                    new GeographicPosition(200, 200)
                }).ToList<IPosition>())

            });

            var multipolygon = new MultiPolygon(new List<Polygon> { polygon1, polygon2 });
            var newFeature = new Feature.Feature(multipolygon);
            var serializedData = JsonConvert.SerializeObject(newFeature, Formatting.Indented, DefaultJsonSerializerSettings);
            var serializedDataWithouWhiteSpace = Regex.Replace(serializedData, @"(\s|$)+", "");
            Assert.IsTrue(serializedDataWithouWhiteSpace == expectedJson);
        }
        public IGeometryObject GetGeometry(IGeometry esriGeometry)
        {
            IGeometryObject geoJsonGeom = null;

            string error = string.Format("A Geometry of type {0} cannot be created", Enum.GetName(typeof(esriGeometryType), esriGeometry.GeometryType));

            switch (esriGeometry.GeometryType)
            {
                case esriGeometryType.esriGeometryAny:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryBag:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryBezier3Curve:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryCircularArc:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryEllipticArc:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryEnvelope:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryLine:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryMultiPatch:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryMultipoint:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryNull:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryPath:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryPoint:
                    //cast to esri obj
                    IPoint point = esriGeometry as IPoint;

                    List<double> coords = new List<double> { point.X, point.Y };

                    //create geojson obj
                    GeoJSON.Net.Geometry.Point pnt = new GeoJSON.Net.Geometry.Point(coords);
                    geoJsonGeom = pnt;
                    break;
                case esriGeometryType.esriGeometryPolygon:
                    IGeometryCollection polygons = esriGeometry as IGeometryCollection;

                    List<LineString> linearRings = new List<LineString>();

                    var rings = new List<List<List<double>>>();
                    var ring = new List<List<double>>();

                    //todo - how does esri handle polygons with holes
                    for (int i = 0; i < polygons.GeometryCount; i++)
                    {
                        //for each geometry in the polygon create a point collection
                        var pGeom = polygons.Geometry[i];
                        var pntCollection = (IPointCollection)pGeom;

                        //GeoJSON.Net.Geometry.LineString line = new LineString();
                        for (var a = 0; a < pntCollection.PointCount; a++)
                        {
                            //create a list of coordinates for each line
                            List<double> linePointCoords = new List<double> { pntCollection.Point[a].X, pntCollection.Point[a].Y };

                            //..and add them to the poly
                            ring.Add(linePointCoords);
                        }

                        rings.Add(ring);
                    }

                    //initialise a poly
                    GeoJSON.Net.Geometry.Polygon poly = new GeoJSON.Net.Geometry.Polygon(rings);

                    geoJsonGeom = poly;
                    break;
                case esriGeometryType.esriGeometryPolyline:

                    //cast to esri obj
                    IGeometryCollection polylines = esriGeometry as IGeometryCollection;

                    //create geojson obj
                    GeoJSON.Net.Geometry.LineString polyLine = new LineString();

                    for (int i = 0; i < polylines.GeometryCount; i++)
                    {
                        //for each geometry in the polyline create a point collection
                        var pGeom = polylines.Geometry[i];
                        var pntCollection = (IPointCollection)pGeom;

                        for (var a = 0; a < pntCollection.PointCount; a++)
                        {
                            //create a list of coordinates for each line
                            List<double> linePointCoords = new List<double> { pntCollection.Point[a].X, pntCollection.Point[a].Y };

                            //..and add them to the line
                            polyLine.Coordinates.Add(linePointCoords);
                        }
                    }

                    geoJsonGeom = polyLine;

                    break;
                case esriGeometryType.esriGeometryRay:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryRing:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometrySphere:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryTriangleFan:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryTriangleStrip:
                    throw new ArgumentOutOfRangeException(error);
                case esriGeometryType.esriGeometryTriangles:
                    throw new ArgumentOutOfRangeException(error);
                default:
                    throw new ArgumentOutOfRangeException(error);
            }

            return geoJsonGeom;
        }
Example #26
0
 protected bool Equals(Polygon other)
 {
     return base.Equals(other) && Coordinates.SequenceEqual(other.Coordinates);
 }
Example #27
0
 protected bool Equals(Polygon other)
 {
     return(base.Equals(other) && Coordinates.SequenceEqual(other.Coordinates));
 }
Example #28
0
 private Polygon GetPolygon(double offset = 0.0)
 {
     var polygon = new Polygon(new List<LineString>
     {
         new LineString(new List<GeographicPosition>
         {
             new GeographicPosition(52.379790828551016 + offset, 5.3173828125 + offset),
             new GeographicPosition(52.36721467920585 + offset, 5.456085205078125 + offset),
             new GeographicPosition(52.303440474272755 + offset, 5.386047363281249 + offset, 4.23 + offset),
             new GeographicPosition(52.379790828551016 + offset, 5.3173828125 + offset),
         })
     });
     return polygon;
 }
		public ToSqlGeometryTests()
		{
			point = new Point(new GeographicPosition(53.2455662, 90.65464646));

			multiPoint = new MultiPoint(new List<Point>
                {
                    new Point(new GeographicPosition(52.379790828551016, 5.3173828125)),
                    new Point(new GeographicPosition(52.36721467920585, 5.456085205078125)),
                    new Point(new GeographicPosition(52.303440474272755, 5.386047363281249, 4.23))
                });
			lineString = new LineString(new List<IPosition>
                {
                    new GeographicPosition(52.379790828551016, 5.3173828125),
                    new GeographicPosition(52.36721467920585, 5.456085205078125),
                    new GeographicPosition(52.303440474272755, 5.386047363281249, 4.23)
                });
			multiLineString = new MultiLineString(new List<LineString>
                {
                    new LineString(new List<IPosition>
                    {
                        new GeographicPosition(52.379790828551016, 5.3173828125),
                        new GeographicPosition(52.36721467920585, 5.456085205078125),
                        new GeographicPosition(52.303440474272755, 5.386047363281249, 4.23)
                    }),
                    new LineString(new List<IPosition>
                    {
                        new GeographicPosition(52.379790828551016, 5.3273828125),
                        new GeographicPosition(52.36721467920585, 5.486085205078125),
                        new GeographicPosition(52.303440474272755, 5.426047363281249, 4.23)
                    })
                });

			polygonWithHole = new Polygon(new List<LineString>
                {
                    new LineString(new List<GeographicPosition>
                    {
											new GeographicPosition(0.516357421875, 47.6415668949958),
											new GeographicPosition(0.516357421875, 47.34463879017405),
											new GeographicPosition(0.977783203125, 47.22539733216678),
											new GeographicPosition(1.175537109375, 47.463611506072866),
											new GeographicPosition(0.516357421875, 47.6415668949958)
                    }),
										 new LineString(new List<GeographicPosition>
											{
												new GeographicPosition(0.630340576171875, 47.54944962456812),
												new GeographicPosition(0.630340576171875, 47.49380564962583),
												new GeographicPosition(0.729217529296875, 47.482669772098674),
												new GeographicPosition(0.731964111328125, 47.53276262898896),
												new GeographicPosition(0.630340576171875, 47.54944962456812)
											})
								});
			polygon = new Polygon(new List<LineString>
                {
                    new LineString(new List<GeographicPosition>
                    {
                        new GeographicPosition(52.379790828551016, 5.3173828125),
                        new GeographicPosition(52.36721467920585, 5.456085205078125),
                        new GeographicPosition(52.303440474272755, 5.386047363281249, 4.23),
                        new GeographicPosition(52.379790828551016, 5.3173828125)
                    })
                });

			multiPolygon = new MultiPolygon(new List<Polygon>
                {
                    new Polygon(new List<LineString>
                    {
                        new LineString(new List<IPosition>
                        {
                            new GeographicPosition(52.959676831105995, -2.6797102391514338),
                            new GeographicPosition(52.9608756693609, -2.6769029474483279),
                            new GeographicPosition(52.908449372833715, -2.6079763270327119),
                            new GeographicPosition(52.891287242948195, -2.5815104708998668),
                            new GeographicPosition(52.875476700983896, -2.5851645010668989),
                            new GeographicPosition(52.882954723868622, -2.6050779098387191),
                            new GeographicPosition(52.875255907042678, -2.6373482332006359),
                            new GeographicPosition(52.878791122091066, -2.6932445076063951),
                            new GeographicPosition(52.89564268523565, -2.6931334629377890),
                            new GeographicPosition(52.930592009390175, -2.6548779332193022),
                            new GeographicPosition(52.959676831105995, -2.6797102391514338)
                        })
                    }),
                    new Polygon(new List<LineString>
                    {
                        new LineString(new List<IPosition>
                        {
                            new GeographicPosition(52.89610842810761, -2.69628632041613),
                            new GeographicPosition(52.8894641454077, -2.75901233808515),
                            new GeographicPosition(52.89938894657412, -2.7663172788742449),
                            new GeographicPosition(52.90253773227807, -2.804554822840895),
                            new GeographicPosition(52.929801009654575, -2.83848602260174),
                            new GeographicPosition(52.94013913205788, -2.838979264607087),
                            new GeographicPosition(52.937353122653533, -2.7978187468478741),
                            new GeographicPosition(52.920394929466184, -2.772273870352612),
                            new GeographicPosition(52.926572918779222, -2.6996509024137052),
                            new GeographicPosition(52.89610842810761, -2.69628632041613)
                        })
                    })
                });

			geomCollection = new GeometryCollection(new List<IGeometryObject>
                {
                    point,
                    multiPoint,
                    lineString,
                    multiLineString,
                    polygon,
                    multiPolygon
                });

			feature = new Feature.Feature(polygon, new Dictionary<string, object>() { { "Key", "Value" } }, "Id");

			featureCollection = new FeatureCollection(new List<Feature.Feature> {
					feature, new Feature.Feature(multiPolygon, null)
			});

		}
 private static Polygon GetPolygon(List<List<GeographicPosition>> lines)
 {
     var res = new List<LineString>();
     foreach (var innerring in lines)
     {
         var line = new LineString(innerring);
         if (line.IsLinearRing() && line.IsClosed())
         {
             res.Add(line);
         }
     }
     var geom = new Polygon(res);
     return geom;
 }
Example #31
0
        public void Can_Serialize_Polygon_Feature()
        {
            var coordinates = new List<GeographicPosition>
            {
                new GeographicPosition(52.370725881211314, 4.889259338378906),
                new GeographicPosition(52.3711451105601, 4.895267486572266),
                new GeographicPosition(52.36931095278263, 4.892091751098633),
                new GeographicPosition(52.370725881211314, 4.889259338378906)
            };

            var polygon = new Polygon(new List<LineString> { new LineString(coordinates) });
            var properties = new Dictionary<string, object> { { "Name", "Foo" } };
            var feature = new Net.Feature.Feature(polygon, properties);

            var expectedJson = GetExpectedJson();
            var actualJson = JsonConvert.SerializeObject(feature);

            JsonAssert.AreEqual(expectedJson, actualJson);
        }
		private IGeometryObject ConstructGeometryPart(SinkGeometry<OpenGisGeographyType> geomPart)
		{

			IGeometryObject geometry = null;

			switch (geomPart.GeometryType)
			{
				case OpenGisGeographyType.Point:
					geometry = new Point(geomPart[0][0]);
					break;
				case OpenGisGeographyType.MultiPoint:
					MultiPoint mp = new MultiPoint(geomPart.Select(g => new Point(g[0])).ToList());
					geometry = mp;
					break;
				case OpenGisGeographyType.LineString:
					geometry = new LineString(geomPart[0]);
					break;
				case OpenGisGeographyType.MultiLineString:
					geometry = new MultiLineString(geomPart.Select(line => new LineString(line))
																																		.ToList()
																															);
					break;
				case OpenGisGeographyType.Polygon:
					geometry = new Polygon(geomPart.Select(line => new LineString(line))
																																		.ToList()
																															);
					break;

				default:
					throw new NotSupportedException("Geometry type " + geomPart.GeometryType.ToString() + " is not supported yet.");
			}

			return geometry;
		}
		private static void Internal_FillGeometryBuilder(SqlGeometryBuilder gb, Polygon polygon)
		{
			gb.BeginGeometry(OpenGisGeometryType.Polygon);
			foreach (var lineString in polygon.Coordinates)
			{
				bool beginFigureCalled = false;
				foreach (var ipos in lineString.Coordinates)
				{
					GeographicPosition pos = ipos as GeographicPosition;
					if (!beginFigureCalled)
					{
						gb.BeginFigure(pos.Longitude, pos.Latitude);
						beginFigureCalled = true;
					}
					else
					{
						gb.AddLine(pos.Longitude, pos.Latitude);
					}
				}
				gb.EndFigure();
			}
			gb.EndGeometry();
		}