Skip to content

Commit

Permalink
port createNewLayer from L.esri.featureLayer for renderer plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois committed Jun 20, 2020
1 parent 28c04a4 commit 04c1818
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 23 deletions.
84 changes: 62 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/ClusterFeatureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ export var FeatureLayer = FeatureManager.extend({
* Feature Management Methods
*/

createNewLayer: function (geojson) {
var layer = GeoJSON.geometryToLayer(geojson, this.options);
// trap for GeoJSON without geometry
if (layer) {
layer.defaultOptions = layer.options;
}
return layer;
},

createLayers: function (features) {
var markers = [];

Expand All @@ -53,7 +62,7 @@ export var FeatureLayer = FeatureManager.extend({
var layer = this._layers[geojson.id];

if (!layer) {
layer = L.GeoJSON.geometryToLayer(geojson, this.options);
layer = this.createNewLayer(geojson);
layer.feature = L.GeoJSON.asFeature(geojson);
layer.defaultOptions = layer.options;
layer._leaflet_id = this._key + '_' + geojson.id;
Expand Down

0 comments on commit 04c1818

Please sign in to comment.