public void PolygonToGeoJsonTest()
        {
            var polygon = new Polygon(
                new List <LineString>
            {
                new LineString(
                    new List <GeographicPosition>
                {
                    new GeographicPosition(35, 10),
                    new GeographicPosition(45, 45),
                    new GeographicPosition(15, 40),
                    new GeographicPosition(10, 20),
                    new GeographicPosition(35, 10)
                }
                    ),
                new LineString(
                    new List <GeographicPosition>
                {
                    new GeographicPosition(20, 30),
                    new GeographicPosition(35, 35),
                    new GeographicPosition(30, 20),
                    new GeographicPosition(20, 30)
                }
                    )
            }
                );
            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(polygon)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"Polygon\""));
        }
        public void EmptyFeatureCollectionToGeoJsonTest()
        {
            var featureCollection     = new FeatureCollection();
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"FeatureCollection\""));
        }
        public void MultiLineStringToGeoJsonTest()
        {
            var multilinestring = new MultiLineString(
                new List <LineString>
            {
                new LineString(
                    new List <GeographicPosition>
                {
                    new GeographicPosition(10, 10),
                    new GeographicPosition(20, 20),
                    new GeographicPosition(10, 40)
                }
                    ),
                new LineString(
                    new List <GeographicPosition>
                {
                    new GeographicPosition(40, 40),
                    new GeographicPosition(30, 30),
                    new GeographicPosition(40, 40),
                    new GeographicPosition(30, 10)
                }
                    )
            }
                );
            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(multilinestring)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"MultiLineString\""));
        }
        public void GeometryCollectionToGeoJsonTest()
        {
            var geometrycollection = new GeometryCollection(
                new List <IGeometryObject>
            {
                new Point(
                    new GeographicPosition(4, 6)
                    ),
                new LineString(
                    new List <GeographicPosition>
                {
                    new GeographicPosition(4, 6),
                    new GeographicPosition(7, 10)
                }
                    )
            }
                );

            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(geometrycollection)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"GeometryCollection\""));
        }
        public void EmptyPolygonToGeoJsonTest()
        {
            var polygon           = new Polygon(new List <LineString>());
            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(polygon)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"Polygon\""));
        }
        public void PointToGeoJsonTest()
        {
            var point             = new Point(new GeographicPosition(150.555, -10.666));
            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(point)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"Point\""));
        }
        public void LineStringToGeoJsonTest()
        {
            var linestring = new LineString(new List <GeographicPosition>
            {
                new GeographicPosition(30, 10),
                new GeographicPosition(31, 11),
                new GeographicPosition(32, 12)
            });
            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(linestring)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"LineString\""));
        }
        public void MultiPointToGeoJsonTest()
        {
            var multipoint = new MultiPoint(new List <Point>
            {
                new Point(new GeographicPosition(10, 40)),
                new Point(new GeographicPosition(40, 30)),
                new Point(new GeographicPosition(20, 20)),
                new Point(new GeographicPosition(30, 10))
            });
            var featureCollection = new FeatureCollection(new List <Feature> {
                new Feature(multipoint)
            });
            var featureCollectionJson = GeoJsonWriter.ToGeoJson(featureCollection);

            Assert.True(featureCollectionJson.Contains("\"type\":\"MultiPoint\""));
        }