public override void WriteMultiPoint(Microsoft.SqlServer.Types.SqlGeometry geom)
 {
     for (int i = 1; i <= geom.STNumPoints().Value; i++)
     {
         this.WritePoint(geom.STPointN(i));
     }
 }
Beispiel #2
0
        private ViewModel.Polyline GetFromSqlGeometry(Microsoft.SqlServer.Types.SqlGeometry multiPoint)
        {
            var result = new ViewModel.Polyline()
            {
                Locations = new LocationCollection()
            };

            for (int i = 1; i <= multiPoint.STNumPoints(); i++)
            {
                Microsoft.SqlServer.Types.SqlGeometry point = multiPoint.STPointN(i);
                result.Locations.Add(new Location((double)point.STY, (double)point.STX));
            }
            return(result);
        }
Beispiel #3
0
        public static Dictionary <string, object> LineStringToJson(Microsoft.SqlServer.Types.SqlGeometry lineString)
        {
            Dictionary <string, object> geometry = new Dictionary <string, object>();

            geometry.Add("type", "LineString");
            List <object> coordinates = new List <object>();
            int           points      = (int)lineString.STNumPoints();

            for (int i = 1; i <= points; i++)
            {
                List <object> coordinate = new List <object>();
                coordinate.Add(Convert.ToDouble(lineString.STPointN(i).STX.Value));
                coordinate.Add(Convert.ToDouble(lineString.STPointN(i).STY.Value));
                coordinates.Add(coordinate);
            }
            geometry.Add("coordinates", coordinates);
            return(geometry);
        }
Beispiel #4
0
        public override void WriteMultiPoint(Microsoft.SqlServer.Types.SqlGeometry geom)
        {
            try
            {
                List <double[]> ptCoords = new List <double[]>();

                for (int i = 1; i < geom.STNumPoints().Value; i++)
                {
                    ptCoords.Add(this.ConvertPoint(geom.STPointN(i)));
                }

                GeoJson.MultiPoint multiPt = new GeoJson.MultiPoint();
                multiPt.coordinates = ptCoords.ToArray();
                _features.Add(new GeoJson.Feature()
                {
                    geometry = multiPt
                });
            }
            catch (Exception)
            {
                throw;
            }
        }