Skip to content

Commit

Permalink
Merge ed63e73 into ae20588
Browse files Browse the repository at this point in the history
  • Loading branch information
airof98 committed Mar 19, 2020
2 parents ae20588 + ed63e73 commit 2872646
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/models.dart
Expand Up @@ -76,7 +76,7 @@ class GeoJsonFeature<T> {
switch (type) {
case GeoJsonFeatureType.point:
final geom = geometry as GeoJsonPoint;
featStr = geom.serializeFeature();
featStr = geom.serializeFeature(properties);
break;
case GeoJsonFeatureType.multipoint:
final geom = geometry as GeoJsonMultiPoint;
Expand Down Expand Up @@ -175,7 +175,12 @@ class GeoJsonPoint {
String name;

/// Serialize to a geojson feature string
String serializeFeature() => geoPoint.toGeoJsonFeatureString();
String serializeFeature(Map properties) {
final p = properties ?? <String, dynamic>{};
return '{"type":"Feature","properties":${jsonEncode(p)},'
'"geometry":{"type":"Point",'
'"coordinates":' + geoPoint.toGeoJsonCoordinatesString() + '}}';
}
}

/// Multiple points
Expand Down

0 comments on commit 2872646

Please sign in to comment.