bozdoz / wp-plugin-leaflet-map

Add leaflet maps to Wordpress with shortcodes
https://wordpress.org/plugins/leaflet-map/
GNU General Public License v2.0
140 stars 71 forks source link

Adding a label to a GeoJSON layer #102

Closed jmarchand-jive closed 3 years ago

jmarchand-jive commented 4 years ago

I'd love to be able to add a label to a GeoJSON label, ideally one inside the Json file, but any custom text would do really in my case...

Do you know of a quick workaround which would work at the moment?

bozdoz commented 4 years ago

I think there's an example of this in the shortcode helper page in the admin; basically if your geojson has a property "a": "hello", you can access it like:

[leaflet-geojson src="./your.geojson"]This is "a": {a}[/leaflet-geojson]

This is defined in the geojson options: https://github.com/bozdoz/wp-plugin-leaflet-map#leaflet-geojson-options

jmarchand-jive commented 4 years ago

Yes, but in this case, we need to have the user click on it in order to show up in the map, right?

bozdoz commented 4 years ago

Yes. You could look up plugins here to find some kind of label like that: https://leafletjs.com/plugins.html. I don't believe you could do it without extending the library.