Skip to content

Commit c8b86dc

Browse files
authored
Merge pull request #625 from aoles/master
Add check for `properties` in GeoJSON objects
2 parents 59cdc31 + 9dc31ff commit c8b86dc

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ BUG FIXES and IMPROVEMENTS
66
* invokeRemote() now resolves html dependencies before passing them to shiny::createWebDependency() (#620).
77
* Upgrade leaflet-provider to 1.4.0, enable more map variants such as CartoDB.Voyager (#567)
88
* `sf` objects with `names` attributes in the `st_geometry` now visualise correctly (#595)
9+
* GeoJSON objects missing `properties` can now be displayed (#622)
910

1011

1112

inst/htmlwidgets/leaflet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1779,7 +1779,7 @@ methods.addGeoJSON = function (data, layerId, group, style) {
17791779
featureId: feature.id,
17801780
properties: feature.properties
17811781
};
1782-
var popup = feature.properties.popup;
1782+
var popup = feature.properties ? feature.properties.popup : null;
17831783
if (typeof popup !== "undefined" && popup !== null) layer.bindPopup(popup);
17841784
layer.on("click", mouseHandler(self.id, layerId, group, "geojson_click", extraInfo), this);
17851785
layer.on("mouseover", mouseHandler(self.id, layerId, group, "geojson_mouseover", extraInfo), this);

javascript/src/methods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ methods.addGeoJSON = function(data, layerId, group, style) {
591591
featureId: feature.id,
592592
properties: feature.properties
593593
};
594-
let popup = feature.properties.popup;
594+
let popup = feature.properties ? feature.properties.popup : null;
595595
if (typeof popup !== "undefined" && popup !== null) layer.bindPopup(popup);
596596
layer.on("click", mouseHandler(self.id, layerId, group, "geojson_click", extraInfo), this);
597597
layer.on("mouseover", mouseHandler(self.id, layerId, group, "geojson_mouseover", extraInfo), this);

0 commit comments

Comments
 (0)