public override void WriteMultiLineString(Microsoft.SqlServer.Types.SqlGeometry geom)
 {
     for (int i = 1; i <= geom.STNumGeometries().Value; i++)
     {
         this.WriteLineString(geom.STGeometryN(i));
     }
 }
Example #2
0
        public override void WriteMultiPolygon(Microsoft.SqlServer.Types.SqlGeometry geom)
        {
            try
            {
                List <double[][][]> polygons = new List <double[][][]>(geom.STNumGeometries().Value);
                for (int i = 1; i <= geom.STNumGeometries().Value; i++)
                {
                    SqlGeometry        curPoly       = geom.STGeometryN(i);
                    List <SqlGeometry> interiorRings = null;
                    int numIntRings = curPoly.STNumInteriorRing().Value;
                    if (numIntRings > 0)
                    {
                        interiorRings = new List <SqlGeometry>(numIntRings);
                        for (int j = 1; j <= numIntRings; j++)
                        {
                            interiorRings.Add(curPoly.STInteriorRingN(j));
                        }
                    }

                    polygons.Add(this.GeoJsonPolygonFromSqlGeometry(geom.STExteriorRing(), interiorRings).coordinates);
                }


                GeoJson.MultiPolygon multiPoly = new GeoJson.MultiPolygon();
                multiPoly.coordinates = polygons.ToArray();
                _features.Add(new GeoJson.Feature()
                {
                    geometry = multiPoly
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
 public override void WriteMultiPolygon(Microsoft.SqlServer.Types.SqlGeometry geom)
 {
     try
     {
         for (int i = 1; i <= geom.STNumGeometries().Value; i++)
         {
             this.WritePolygon(geom.STGeometryN(i));
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
        public override void WriteMultiLineString(Microsoft.SqlServer.Types.SqlGeometry geom)
        {
            List <double[][]> lineStrings = new List <double[][]>();

            try
            {
                for (int i = 1; i <= geom.STNumGeometries().Value; i++)
                {
                    lineStrings.Add(this.GeoJsonLineStringFromSqlGeometry(geom.STGeometryN(i)).coordinates);
                }
            }
            catch (Exception)
            {
                throw;
            }
            _features.Add(new GeoJson.Feature()
            {
                geometry = new GeoJson.MultiLineString()
                {
                    coordinates = lineStrings.ToArray()
                }
            });
        }