Пример #1
0
        public void GeoJSONLineStringToWktTest()
        {
            string json     = "{\"type\":\"FeatureCollection\", \"features\":[{\"type\":\"Feature\", \"crs\" : { \"type\" : \"name\", \"properties\" : { \"name\" : \"epsg:4326\" } } \"geometry\":{\"type\":\"LineString\", \"coordinates\":[[-41.2281722793271, 174.70763047448], [-41.1553878554989, 174.777668316277], [-41.1560745010067, 174.840839702996], [-41.2171859512021, 174.878605205926], [-41.2549514541317, 174.807880718621], [-41.2803573379208, 174.802387554559], [-41.2824172744442, 174.834659893426], [-41.3270492324521, 174.841526348504], [-41.3531417617489, 174.774921734246]]}, \"properties\":{}}]}";
            string expected = "LINESTRING (-41.2281722793271 174.70763047448, -41.1553878554989 174.777668316277, -41.1560745010067 174.840839702996, -41.2171859512021 174.878605205926, -41.2549514541317 174.807880718621, -41.2803573379208 174.802387554559, -41.2824172744442 174.834659893426, -41.3270492324521 174.841526348504, -41.3531417617489 174.774921734246)";
            string actual;
            int    srid = 0;

            actual = GeoJSON.GeoJSONToWkt(json, out srid);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(4326, srid);
        }
Пример #2
0
        public void GeoJSONPointToWktTest()
        {
            string json     = "{\"type\":\"FeatureCollection\", \"features\":[{\"type\":\"Feature\", \"crs\" : { \"type\" : \"name\", \"properties\" : { \"name\" : \"epsg:4326\" } } \"geometry\":{\"type\":\"Point\", \"coordinates\":[-41.2281722793271, 174.70763047448]}, \"properties\":{}}]}";
            string expected = "POINT (-41.2281722793271 174.70763047448)";
            string actual;
            int    srid = 0;

            actual = GeoJSON.GeoJSONToWkt(json, out srid);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(4326, srid);
        }