-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Properties #45
Comments
Hi @dariospace, Thanks for reaching out and for your kind words 🙏
I have to apologise for removing this feature without warning! This was one of a number of smaller settings and features that I removed in order to try and simplify the plugin codebase. This was much needed for future plans!
This feature stored expected custom properties by simply appending them to the Overlay Description as a HTML Could you provide more specifics, ideally with an example of what you are trying to achieve? Currently unexpected properties are removed, but I can see that it would be useful to provide a mechanism for storing and accessing expected properties.
Please check out this example, here the title property is accessed for each Overlay like so: layer.feature.properties.title I hope this helps.
This sounds quite custom to your project, however if in the future properties are stored and available as outlined above then yes this kind of customisation would be possible. Are you using this for a commercial project? Would you be willing to sponsor the development of such a feature? Cheers, Joe |
We import them once and we will access them later on the front end programatically, say layer.property.id or layer.property.square_meter
We don't want to modify the code and we couldn't find many filters to get what we need! |
Thanks for the extra detail :)
Instead of disabling, I think a mechanism for storing and accessing expected properties is a good idea. I will definitely think more on this. Cheers, Joe |
Good point, looks of room for improvement here! This might be worth a new issue/discussion to gather ideas for actions/filters. |
**Overlay Properties** - Read GeoJSON feature properties when importing (Settings > Overlays > Properties). If Waymark finds data for the specified property keys they will stored upon import. These can be automatically appended to the Overlay Description, or accessed programatically via the `layer.feature.properties` Object. Thanks to [dariospace](https://github.com/dariospace) for the [requesting](#45) the return of this feature.
Hi @dariospace, I have just released v1.3.0 of the plugin:
Once the expected properties have been imported, they can now be accessed on the front-end like so: //Our Callback Function
const waymark_properties = (Waymark) => {
if (typeof Waymark !== "object" || typeof jQuery !== "function") {
console.error("Waymark or jQuery not loaded");
}
// Iterate over each Overlay
Waymark.map_data.eachLayer(function(layer) {
// When the layer is clicked
layer.on('click', function(e) {
alert(JSON.stringify(e.target.feature.properties));
});
});
}; Please let me know if this works as expected for you. Cheers, Joe |
Hey @morehawes, awesome work with Waymark Jow! It deserves more stars ⭐️. Quick questions:
Cheers mate!
The text was updated successfully, but these errors were encountered: