Пример #1
0
    public static string GeometryFromWKT()
    {
        string WKT = "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))";

        GeoJsonGeometry geometry = GeoJsonGeometry.FromWKTGeometry(WKT);

        return(geometry.Serialize(prettyPrint: true));
    }
Пример #2
0
    public static string GeometryFromDB()
    {
        if (!TestDBConnection())
        {
            return(null);
        }


        using (Entities db = new Entities())
        {
            DbGeometry data = (from row in db.SampleTables select row.SpatialData).FirstOrDefault();

            GeoJsonGeometry geometry = GeoJsonGeometry.FromDbGeometry(data);
            return(geometry.Serialize(prettyPrint: true));
        }
    }