tileserver-gl icon indicating copy to clipboard operation
tileserver-gl copied to clipboard

Attach sprites to configuration

Open qubiack opened this issue 5 years ago • 3 comments

In the documentation, I found information that we can add some sprites files but I can't attach them directly to style. I would like to have access to sprites with links like http://localhost:4800/styles/dionisos/sprite so for example: http://localhost:4800/styles/dionisos/sprite.json

It's possible to attach files directly to style? How can I do that?

{
  "options": {
    "paths": {
      "root": "/data",
      "fonts": "fonts",
      "styles": "styles",
      "sprites": "sprites",
      "mbtiles": "mbtiles"
    }
  },
  "styles": {
    "dioniso": {
      "style": "dioniso/style.json"
    }
  },
  "data": {
    "v3": {
      "mbtiles": "zurich.mbtiles"
    }
  }
}

qubiack avatar Apr 25 '21 17:04 qubiack

Unsure if this is the issue, but your config.json file has the style name 'dioniso' and your url path has 'dionisios' (with an 's' at the end). If this is the issue can you share how you use config.json because I haven't found a way to do it. In fact, I am still unsure how to use config.json to get the tileserver to start with a style different than basic-preview. I am using make start-tileserver from openmaptiles to create a docker container. Have you been able to do this?

However, I have been able to add my own styles, sprites and glyphs using this method.

I pretty much just copy the sprite sheet into the server and then just restart the server.

copy sprite sheets: docker cp sprite.json [container_id]:/app/node_modules/tileserver-gl-styles/sprites/dioniso/sprite.json

I think you need to also add sprite.png, [email protected], and [email protected].

After this just restart the docker container. Also make sure your sprite path is correct in style.json. If you put it in the same path that I did, then you just need to have "sprite": "sprites/custom_night/sprite".

It should now be accessible at http://localhost:8080/styles/dionisos/sprite.json. or on whatever port you are using.

-Andres

amorfinv avatar Apr 26 '21 07:04 amorfinv

I have 4 files - sprites - 2 png and 2 JSON files, but it's I suppose impossible to configure it as expected. The documentation for Tileserver-gl is really poor in this aspect - there is some information about sprites but no information on how we define access for them or any dir structure to show an example.

qubiack avatar Jun 14 '21 18:06 qubiack

Yeah, the documentation is not very clear how it should be done. However, I think the method from #530 should work. I have been able to add my own sprites in this way. How does your style.json look?

amorfinv avatar Jun 14 '21 20:06 amorfinv