maplibre / maputnik

An open source visual editor for the 'MapLibre Style Specification'
https://www.maplibre.org/maputnik
MIT License
2.13k stars 401 forks source link

Edit the icon image of a POI #527

Closed MaheshVyomSharma closed 5 years ago

MaheshVyomSharma commented 5 years ago

Hi,

A newbie here trying to customize a vector map. I am looking to customize the icons of a particular type of POI. For example, the country's national flag icon on all government facilities; a company's logo on all their facilities etc. I have so far tried creating a layer that is a replica of poi-level-3, but unfortunately that is updating all poi-3 with the same icon. How can I achieve this? I have also gone through quite a few Youtube videos and blogs, but have not been successful so far. I am using docker image tileserver-gl and Maputnik online for my work; using osm-bright style as the basis. Please help me out with necessary guidance.

pathmapper commented 5 years ago

Hi @MaheshVyomSharma ,

but unfortunately that is updating all poi-3 with the same icon.

If you are using OpenMapTiles as vector source you would need to filter the POIs based on class:

https://openmaptiles.org/schema/#poi https://github.com/openmaptiles/openmaptiles/blob/master/layers/poi/class.sql

For using your own icons, here are some resources as starting points:

  1. You could create your own sprite with the icons you want and use them for your style:

Sprite docs: https://docs.mapbox.com/mapbox-gl-js/style-spec/#sprite

Generate own sprite: https://github.com/maputnik/osm-liberty#icon-design

  1. Load an icon from an external URL and use it for your style:

Example: https://docs.mapbox.com/mapbox-gl-js/example/add-image/

Docs: https://docs.mapbox.com/mapbox-gl-js/api/#map#loadimage https://docs.mapbox.com/mapbox-gl-js/api/#map#addimage

Closing here, as this is not really a question about Maputnik. If you have further questions about this matter I suggest to ask them on https://gis.stackexchange.com/.

joostschouppe commented 7 months ago

Two notes about this:

HarelM commented 7 months ago

There's a whole section about sprites in the maplibre spec here: https://maplibre.org/maplibre-style-spec/sprite/ I'm not sure it's worth repeating...

joostschouppe commented 6 months ago

Yes, you're right. While I see now that https://maplibre.org/maplibre-style-spec is mentioned in the readme, there seems to be no link from https://github.com/maplibre/maputnik/wiki to there. It probably makes sense to repeat the first sentence of the readme there

HarelM commented 6 months ago

I have added a note to the maputnik wiki, I hope it will be useful to people.