Esempio n. 1
0
 public void walking_point()
 {
     var walker = new GeoJsonObjectWalker(GetObjectFromJson<Point>("point"));
     walker.CarryOut(GeoVisitor);
     GeoVisitor.VisitedObjects.Count.ShouldBe(1);
     GeoVisitor.AssertType<Point>(0);
 }
        public void walking_point()
        {
            var walker = new GeoJsonObjectWalker(GetObjectFromJson <Point>("point"));

            walker.CarryOut(GeoVisitor);
            GeoVisitor.VisitedObjects.Count.ShouldBe(1);
            GeoVisitor.AssertType <Point>(0);
        }
Esempio n. 3
0
 public void walking_feature_collection()
 {
     var walker = new GeoJsonObjectWalker(GetObjectFromJson<FeatureCollection>("ng_earthquakes"));
     walker.CarryOut(GeoVisitor);
     GeoVisitor.VisitedObjects.Count.ShouldBe(369); // 1 feature Collection with 184 Features, each with a point = 1 + 184 *2
     GeoVisitor.AssertType<Feature>(181);
     GeoVisitor.AssertType<Point>(172);
     GeoVisitor.AssertStackDepth(172, 2);
 }
Esempio n. 4
0
 public void walking_complex_geo()
 {
     var walker = new GeoJsonObjectWalker(GetObjectFromJson<GeometryCollection>("geometrycollection"));
     walker.CarryOut(GeoVisitor);
     GeoVisitor.VisitedObjects.Count.ShouldBe(11);
     GeoVisitor.AssertType<Point>(1);
     GeoVisitor.AssertType<LineString>(4); // gcl@0 -> polygon@3 -> linestring
     GeoVisitor.AssertType<MultiPolygon>(5); // gcl@0 -> polygon@5 (-> 1xpolygon + 1xlinestring + 1xpolygon + 2xlinestrings)
 }
        public void walking_feature_collection()
        {
            var walker = new GeoJsonObjectWalker(GetObjectFromJson <FeatureCollection>("ng_earthquakes"));

            walker.CarryOut(GeoVisitor);
            GeoVisitor.VisitedObjects.Count.ShouldBe(369); // 1 feature Collection with 184 Features, each with a point = 1 + 184 *2
            GeoVisitor.AssertType <Feature>(181);
            GeoVisitor.AssertType <Point>(172);
            GeoVisitor.AssertStackDepth(172, 2);
        }
        public void walking_complex_geo()
        {
            var walker = new GeoJsonObjectWalker(GetObjectFromJson <GeometryCollection>("geometrycollection"));

            walker.CarryOut(GeoVisitor);
            GeoVisitor.VisitedObjects.Count.ShouldBe(11);
            GeoVisitor.AssertType <Point>(1);
            GeoVisitor.AssertType <LineString>(4);   // gcl@0 -> polygon@3 -> linestring
            GeoVisitor.AssertType <MultiPolygon>(5); // gcl@0 -> polygon@5 (-> 1xpolygon + 1xlinestring + 1xpolygon + 2xlinestrings)
        }
Esempio n. 7
0
 /// <summary>
 /// Translate a GEOJSONObject to the corresponding SqlGeography. Please note that without any additional configuration,
 /// a FeatureCollection will turn into a GeometryCollection and the geometry of each feature will be added to that collection.
 /// </summary>
 public static SqlGeography Translate(GeoJSONObject geoJsonObject)
 {
     AssertValidity();
     var visitor = new GeoJsonToSqlGeographyObjectWalker();
     var walker = new GeoJsonObjectWalker(geoJsonObject);
     walker.CarryOut(visitor);
     return visitor.ConstructedGeography;
 }