mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.14k stars 2.22k forks source link

SpriteAtlas out of space #2164

Closed mapmeld closed 8 years ago

mapmeld commented 8 years ago

In August 2014, I used MapBoxGL to make a Van Gogh texture map: http://mapmeld.github.io/van-gogh-map/#6/42.786/-73.260 which got some positive press: http://thecreatorsproject.vice.com/blog/explore-a-van-gogh-styled-google-maps-remix

I'm updating the map for current MapBoxGL and hopefully making it customizable for people to select other artworks and extract textures from their own images. I got two of the textures loading and then "SpriteAtlas out of space" warning (related to #1897). It is a large sprite.png file, so I shrunk it 50% and got more of the textures to load, but still issues: http://art-maps.herokuapp.com/create It actually depends where you first load the map, so if you open in Antarctica you'll see snow and water but no other textures loaded, and if you open in a forest area you'll get forest textures prioritized first.

screen shot 2016-02-19 at 11 19 28 pm

I don't want to make sprite.png smaller and smaller, so: Is there a target limit? Can I make SpriteAtlas bigger? Is this a bad idea?

Thanks! -- Nick

lucaswoj commented 8 years ago

Hello! There is a finite amount of space in the SpriteAtlas and no easy way to make it larger. As far as I know, nobody has explored designing a basemap using high resolution textures like this.

ref #141

Anything else to add @bhousel @ansis? Any good follow-ups here?

bhousel commented 8 years ago

This is such an awesome map! I love seeing people push the boundaries of what they can do with Mapbox GL..

I don't have anything to add other than that we do plan to improve the resource management of the glyph/sprite atlases so that they can resize larger if needed, and so that the atlas textures only contain what is needed to render the visible portion of the map.

We can leave this issue open and revisit it in a few months..

mapmeld commented 8 years ago

I've downloaded a copy of mapboxgl.js so that I could make SpriteAtlas bigger. Here's an example of it working: http://art-maps.herokuapp.com/map/view/56e4cbd0d08d821100da1f2a#3.09/27.71/-84.70

screen shot 2016-03-12 at 5 31 52 pm

The one landuse that I can't get to work is "sand". On the outdoors JSON, there's a straightforward definition of it: https://github.com/mapbox/mapbox-gl-styles/blob/master/styles/outdoors-v7.json#L400-L413 On my own map it's very similar (https://github.com/mapmeld/texture-maps/blob/master/static/sample-map.js#L120-L127) but using fill-pattern. I can't get it to show up on my map, so the Sahara looks super-empty. I tried switching to fill-color and it wasn't coming through

lucaswoj commented 8 years ago

The one landuse that I can't get to work is "sand".

Please read the documentation for the data source you are using. https://www.mapbox.com/developers/vector-tiles/mapbox-terrain/#landcover

mapmeld commented 8 years ago

Thanks! I'm set for now, then.

Politify commented 8 years ago

Has any progress been made on this? Currently trying to squeeze 338 icons onto the sprite but it keeps throwing the error. Resizing the SVGs doesn't seem to do much either.

mapmeld commented 8 years ago

@Politify for my project I made my own copy of mapboxgl.js and changed the one part where it generates the SpriteAtlas to this.spriteAtlas=new SpriteAtlas(500,1200)

Politify commented 8 years ago

@mapmeld Thank you! You still hosted the sprites with Mapbox, right?

mapmeld commented 8 years ago

I host the sprite and specs myself.

new mapboxgl.Map({
    container: 'map',
    center: [-73.26, 42.786],
    zoom: 6,
    style: {
      "version": 8,
      "sprite": spriteID,

and spriteID is a variable, in this case the string "/halfsprite"

that directs MapBoxGL to pull in /halfsprite.json for the coordinates, and /halfsprite.png, and (mandatory) retina version /halfsprite@2x.png - they all share the same name

Politify commented 8 years ago

Works pretty nicely but some markers are distorted. Not sure if you've run into this problem.

screenshot 2016-05-04 20 10 06