BenjaminVadant / leaflet-ugeojson

A leaflet plugin that updates a geojson layer each time the user move the map
MIT License
39 stars 26 forks source link

Add marker title/icon? #16

Open crystalenka opened 2 years ago

crystalenka commented 2 years ago

Hi!

Thanks very much for this plugin, it's really helpful!

Is there any way to pull the marker title/alt/icon from the GeoJSON when it's creating the markers layer?

I've set some properties and options which is fine, but it doesn't appear to get used anywhere.

Here's an example point that I'm working with:

{
     "type":"Feature",
     "geometry": {
          "type":"Point",
          "coordinates": [-121.917961,37.879574]
     },
     "properties": {
          "id":56,
          "time":"Early Morning (12am-6am)",
          "type":"Live Sighting",
          "species":"Mountain Lion, Puma Concolor",
          "verification":"Confirmed"
     },
     "options": {
          "title":"Sighting: Confirmed, Mountain Lion, Puma Concolor, Live Sighting",
          "alt":"Sighting: Confirmed, Mountain Lion, Puma Concolor, Live Sighting"
     }
}

I'm in full control of the JSON that gets passed, but not sure how to get it to "talk" to Leaflet.

Thank you!

BenjaminVadant commented 2 years ago

Hello, Normally, this plugin works like a "normal" GeoJSON layer so you should be able to apply a style based on the feature properties like described here : https://leafletjs.com/reference.html#geojson

Have a good day !

Benjamin VADANT

Le lun. 30 mai 2022 à 12:13, Crystal Dionysopoulos @.***> a écrit :

Hi!

Thanks very much for this plugin, it's really helpful!

Is there any way to pull the marker title/alt/icon from the GeoJSON when it's creating the markers layer?

I've set some properties and options which is fine, but it doesn't appear to get used anywhere.

Here's an example point that I'm working with:

{ "type":"Feature", "geometry": { "type":"Point", "coordinates": [-121.917961,37.879574] }, "properties": { "id":56, "time":"Early Morning (12am-6am)", "type":"Live Sighting", "species":"Mountain Lion, Puma Concolor", "verification":"Confirmed" }, "options": { "title":"Sighting: Confirmed, Mountain Lion, Puma Concolor, Live Sighting", "alt":"Sighting: Confirmed, Mountain Lion, Puma Concolor, Live Sighting" } }

I'm in full control of the JSON that gets passed, but not sure how to get it to "talk" to Leaflet.

Thank you!

— Reply to this email directly, view it on GitHub https://github.com/BenjaminVadant/leaflet-ugeojson/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7P3AEELTFHLOBBVRQ2RBDVMSIFRANCNFSM5XKBXVEA . You are receiving this because you are subscribed to this thread.Message ID: @.***>