Exemplo n.º 1
0
    public static string FeatureCollectionFromWKT()
    {
        string[] WKTs =
        {
            "POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))",
            "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))",
            "LINESTRING (1 1, 2 2)"
        };

        FeatureCollection features = new FeatureCollection(WKTs);

        return(features.Serialize(prettyPrint: true));
    }
Exemplo n.º 2
0
    public static string FeatureCollectionFromDB()
    {
        if (!TestDBConnection())
        {
            return(null);
        }

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

            FeatureCollection features = new FeatureCollection(data);
            return(features.Serialize(prettyPrint: true));
        }
    }
Exemplo n.º 3
0
        public static string ToGeoJson(DbGeometry geom)
        {
            FeatureCollection features = new FeatureCollection(geom);

            return(Regex.Replace(features.Serialize(prettyPrint: true), @"\s", ""));
        }