markusand / mapboxgl-legend

Add a legend to a mapbox-gl map by parsing layer layout & paint expressions.
ISC License
49 stars 13 forks source link

Add maplibre-gl-js compatibility #22

Open IncidGeo opened 7 months ago

IncidGeo commented 7 months ago

Hi, I'd like to know if this library is also working with maplibre-gl-js ?

markusand commented 7 months ago

Hi. This library is tightly coupled to Mapbox's Control interface and events. I haven't worked with Maplibre, but it seems that Control is the same as Mapbox. As long as it emits the same events and include the same properties, it could potentialy work. I suggest you to try and tell us ☺️

IncidGeo commented 7 months ago

Thank you markusand for your answer, it does not seems to work directly As an exemple to use MapboxDraw in Maplibre i need to add : MapboxDraw.constants.classes.CONTROL_BASE = 'maplibregl-ctrl'; MapboxDraw.constants.classes.CONTROL_PREFIX = 'maplibregl-ctrl-'; MapboxDraw.constants.classes.CONTROL_GROUP = 'maplibregl-ctrl-group';

I try to understand it.

IncidGeo commented 7 months ago

I' had a look to the code, what a nice library ! I won't use 1/100 of the code so I've finally wrote my own code, just need to read the match expression in the map style. It would be very nice to have it for Maplibre, i'm not competent enough to convert it.