Exemplo n.º 1
0
 public static string AsPoint(this GeoLocation location)
 {
     return(string.Format(
                CultureInfo.InvariantCulture,
                "POINT({0})",
                location.AsCoordinates()));
 }
Exemplo n.º 2
0
        public static string AsPolygon(this GeoLocation northEast, GeoLocation southWest)
        {
            var northWest = new GeoLocation()
            {
                Type = "Point", Coordinates = new[] { northEast.Coordinates[0], southWest.Coordinates[1] }
            };
            var southEast = new GeoLocation()
            {
                Type = "Point", Coordinates = new[] { southWest.Coordinates[0], northEast.Coordinates[1] }
            };

            return(string.Format(
                       CultureInfo.InvariantCulture,
                       "POLYGON(({0}, {1}, {2}, {3}, {4}))",
                       northEast.AsCoordinates(),
                       northWest.AsCoordinates(),
                       southWest.AsCoordinates(),
                       southEast.AsCoordinates(),
                       northEast.AsCoordinates()));
        }