Skip to content
This repository has been archived by the owner on Apr 15, 2018. It is now read-only.

Information about svg and sprite file confusion #2

Open
manuelroth opened this issue May 13, 2016 · 8 comments
Open

Information about svg and sprite file confusion #2

manuelroth opened this issue May 13, 2016 · 8 comments

Comments

@manuelroth
Copy link
Member

  • Just found an issue in mapbox-gl-js where mourner says that svg icons can not be used directly with mapbox-gl-js
  • They have to be converted to a sprite.png and sprite.json file with the spritezero-cli tool
@manuelroth manuelroth changed the title Information about svg and sprite.png confusion Information about svg and sprite file confusion May 13, 2016
@manuelroth
Copy link
Member Author

Generating the sprites myself with this tool is not necessary. I just created the style in mapbox studio and then looked for the url where the sprite gets fetched in the network tab.

bildschirmfoto 2016-05-13 um 18 58 20

@muesliq
Copy link

muesliq commented Nov 22, 2016

Could you help me understand SVGs vs sprites?

In this repo there is one PNG sprite per style, plus the according JSON file. It used to be like this in the original Mapbox styles repo as well.

However today they only seem to use one SVGs per icon, no sprite anymore. (They still speak of "spritesheets" however.) Also exporting a style from Mapbox Studio gives you many SVGs and no sprite.

Are sprites still needed? Do I need to convert SVGs to sprites? Or does GL JS or Tileserver GL do the job?

@muesliq
Copy link

muesliq commented Nov 22, 2016

(Or should I convert SVGs to sprites the way you show in your screenshot?)

@manuelroth
Copy link
Member Author

Hi @muesliq, from my understanding Mapbox GL JS still doesn't render the SVG's directly. In Mapbox Studio they still serve the sprite.json and sprite.png file. I would recommend you opening Mapbox Studio create a style of your choice and look for the sprite-requests in the network tab as shown above. This is probably the easiest way to get them.

@klokan
Copy link
Member

klokan commented Nov 22, 2016

@muesliq see README.md at https://github.com/klokantech/osm2vectortiles-gl-styles for instructions how to convert the original resources to required derivates.

We may probably migrate the styles to a one repo per style while implementing the ideas described at: https://github.com/klokantech/gl-style-package-spec

@muesliq
Copy link

muesliq commented Nov 22, 2016

Thanks guys! You are the best, as always.

@muesliq
Copy link

muesliq commented Nov 22, 2016

@klokan Instead of one repo per style I'd rather use one directory per style within one repo, with fonts in one extra directory outside of the style directories, for cross-style usage.

@klokan
Copy link
Member

klokan commented Nov 22, 2016

This prevents a possibility to choose which style you want to download for offline use (as .zip) into a mobile application or which style you want to deploy in a tileserver - please this discussion on the repo above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants