Skip to content

Commit 4dc6ac0

Browse files
committed
Fix GeoJSON serialization when creating new MultiPoint records
1 parent 295c408 commit 4dc6ac0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CHANGELOG
55
0.13.8 (unreleased)
66
-------------------
77

8-
- Nothing changed yet.
8+
* Fix GeoJSON serialization when creating new MultiPoint records
99

1010

1111
0.13.7 (2014-06-26)

leaflet/static/leaflet/leaflet.forms.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ L.FieldStore = L.Class.extend({
2626
if (typeof geom.toGeoJSON != 'function') {
2727
throw 'Unsupported layer type ' + geom.constructor.name;
2828
}
29+
30+
// Leaflet requires access to original feature attribute for GeoJSON
31+
// serialization. (see https://github.com/Leaflet/Leaflet/blob/v0.7.3/src/layer/GeoJSON.js#L256-L258)
32+
// When creating new records, it's empty so we force it here.
33+
if (!geom.feature) {
34+
geom.feature = {geometry: {type: this.options.geom_type}};
35+
}
36+
2937
var geojson = geom.toGeoJSON();
3038
if (is_multi && is_generic) {
3139
var flat = {type: 'GeometryCollection', geometries: []};

0 commit comments

Comments
 (0)