private FeatureCollection GetTestFeatureCollection() { var fc = new FeatureCollection(); _testGeospatialObjects.ForEach(c => { var geom = DbGeometry.FromText(c.Geometry, 4326); var f = DbGeometryToGeoJsonHelper.FromDbGeometry(geom); f.Properties.Add("Name", c.Name); fc.Features.Add(f); }); return(fc); }
public static FeatureCollection FeatureCollectionFromDbGeometry(IEnumerable <DbGeometry> dbGeometries, string featurePropertyName, string featurePropertyValue) { var featureCollectionFromDbGeometry = new FeatureCollection(); if (dbGeometries == null) { return(featureCollectionFromDbGeometry); } foreach (var dbGeometry in dbGeometries.Where(x => x != null)) { var feature = DbGeometryToGeoJsonHelper.FromDbGeometry(dbGeometry); feature.Properties.Add(featurePropertyName, featurePropertyValue); featureCollectionFromDbGeometry.Features.Add(feature); } return(featureCollectionFromDbGeometry); }
public static string MakeDbGeometryIntoGeoJsonString(DbGeometry geometry, Formatting formatting) { var dbGeometryAsFeature = DbGeometryToGeoJsonHelper.FromDbGeometry(geometry); return(JsonTools.SerializeObject(dbGeometryAsFeature, formatting)); }