Skip to content

Commit

Permalink
Rename get_feature_id to feature_id in python
Browse files Browse the repository at this point in the history
  • Loading branch information
lopezvoliver committed Jul 11, 2024
1 parent 4b0320d commit 8376c74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions python/ipyleaflet/ipyleaflet/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ class VectorTileLayer(Layer):
Engine for rendering VectorTileLayers; either 'canvas' or 'svg'. Use 'svg' for interactive layers.
interactive: boolean, default False
Whether the layer is interactive or not.
get_feature_id: string, default None
feature_id: string, default None
Optional attribute name of a unique feature identifier.
"""

Expand All @@ -1133,7 +1133,7 @@ class VectorTileLayer(Layer):
min_native_zoom = Int(default_value=None, allow_none=True).tag(sync=True, o=True)
max_native_zoom = Int(default_value=None, allow_none=True).tag(sync=True, o=True)
renderer = Unicode('svg').tag(sync=True, o=True)
get_feature_id = Unicode(allow_none=True, default_value=None).tag(sync=True, o=True)
feature_id = Unicode(allow_none=True, default_value=None).tag(sync=True, o=True)
feature_style = Dict().tag(sync=True)

def redraw(self):
Expand Down
6 changes: 3 additions & 3 deletions python/jupyter_leaflet/src/layers/VectorTileLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class LeafletVectorTileLayerModel extends LeafletLayerModel {
visible: true,
opacity: 1.0,
rendererFactory: L.svg.tile,
get_feature_id: null,
getFeatureId: null,
};
}
}
Expand All @@ -34,8 +34,8 @@ export class LeafletVectorTileLayerView extends LeafletLayerView {
...this.get_options(),
};

if ('getFeatureId' in options) {
let idVar = options['getFeatureId'];
if ('featureId' in options) {
let idVar = options['featureId'];
options['getFeatureId'] = function (feat: any) {
return feat.properties[idVar];
};
Expand Down

0 comments on commit 8376c74

Please sign in to comment.