Leaflet maps clickable GeoJson feature returns empty object

Hello, In one of my projects I'm using the Leaflet maps widget with GeoJson feature. Im able to load GeoJsons into the map and display them. When clicking one of the GeoJson features the on-click microflow runs. Problem is the fact that this microflow starts with an empty parameter, whereas the widget documentation states that a new object should be created. I have defined the Feature object and Feature ID attribute. When checking the logs I see that the feature is there with all desired data. I'm wondering why it does recognize the data and is able to load it onto the map, but is not able to recognize the ID which is needed to create an object after clicking the feature. Has anyone encountered a similar problem using this widget? In the following part of the JS code a condition should be met in order for an object to be made. It states that e.id should not be equal to “undefined”. However, the documentation of the widget states that a non-persistent object is required. How can I make sure this condition is met? _onClickFeature: function(e) { var t = this; this.log("_onClickFeature", e), "" !== this.entityGeoJSONFeature && "" !== this.attributeGeoJSONFeatureId && "undefined" != typeof e.id ? mx.data.create({ entity: this.entityGeoJSONFeature, callback: function(o) { o.set(t.attributeGeoJSONFeatureId, e.id), "" !== t.clickGeoJSONFeature && t.execute(t.clickGeoJSONFeature, o.getGuid()) }, error: function(o) { console.error(t.id + " Error creating GeoJSON feature: ", o) } }) : "" !== this.clickGeoJSONFeature && this.execute(this.clickGeoJSONFeature) It may simply be a small configuration issue which I have overlooked. Thanks in advance! EDIT: I fixed the issue! It's not looking for a database ID, but for an attribute with the specific name “id” in your GeoJson. Because the keyword “id“ is reserved in Mendix I was using a different attribute name. My solution contains using import mapping on your GeoJson, setting a unique id for each feature object, create and commit the objects to my own database for later user, use export mapping to get the whole thing back to a single string and saving that as the GeoJson content. By using the unique ID that is set I retrieve the correct objects from the DB. Works like a charm!
0 answers