-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom style(s) - how? #530
Comments
Anyone? |
This is a minimal
|
Thank you for stepping in to help! The URL from the mapbox website? I have downloaded a zip of the style (with accompanying resources) but I have yet to get everything configured correctly. Here is my docker command docker run --rm -it -v "/d/Code/Maps/MBTiles/North America/":/data/ -v /d/Code/Maps/tile-server-gl/config/:/config -p 8080:80 maptiler/tileserver-gl --config /config/config.json My config folder looks like this here is my config.json { here is the style.json for the Frank style { the error I get when starting the docker container is this (lots of them) Starting tileserver-gl v3.1.1 |
I changed my config.json to this - changing the "sources" to map to the local mbtiles { then I also change the style.json "sources": { The docker runs now without any errors, but theres nothing at localhost:8080 - its not responding to requests so there must be something else wrong but I dont know how/where to look |
You must expose port |
At this point, you must apply some styling. I would grab the TileJSON URL and add it as a data source in Maputnik. You can play around with the style their and then export the |
I have a style I downloaded from MapBox - "Frank" and I tried to add it to the config. I can see that via WMTS I can get tiles, but there are no labels (no street names, city, state names, etc). The web page is blank though |
sorry I must really be confused - pretty new to all this map tile server stuff. I'm trying to use a style from MapBox. But I've seen others mention using styles from the openmaptiles project - theres some special 'local' json files. Can I only use those? |
This is my (censored) minimal
Result: I cannot help you any further as I'm not using |
Thank you. What are you running, if you don't mind me asking?
On Tue, Mar 30, 2021 at 5:45 AM, Stefan ***@***.***> wrote:
This is my (censored) minimal style.json:
{
"version": 8,
"name": "Demo",
"metadata": {
"maputnik:license": "https://github.com/maputnik/osm-liberty/blob/gh-pages/LICENSE.md",
"maputnik:renderer": "mbgljs",
"openmaptiles:version": "3.x"
},
"sources": {
"public": {
"type": "vector",
"tiles": [
"https://path/to/tiles/{z}/{x}/{y}.pbf"
],
"minZoom": 0,
"maxZoom": 14
}
},
"sprite": "https://maputnik.github.io/osm-liberty/sprites/osm-liberty",
"glyphs": "https://api.maptiler.com/fonts/{fontstack}/{range}.pbf?key={key}",
"layers": [
{
"id": "public",
"type": "fill",
"source": "public",
"source-layer": "public.layer",
"paint": {"fill-color": "rgba(41, 99, 39, 1)"}
}
],
"id": "demo"
}
I cannot help you any further as I'm not using tileserver-gl I was just trying to get it to run.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I was trying get Turns out, it is not trivial: https://gis.stackexchange.com/questions/387442/render-raster-from-vector-tiles-in-wgs84-epsg4326-using-tileserver-gl |
Ok thanks for the help so far |
So does anyone involved intimately with this project have any thoughts or documentation on how users can provide custom styles? I feel like that would be highly valuable and almost a necessity of using this project. I guess some users might be ok with the "Basic-Preview" style. |
I have exactly the same problem now. Could you (@ftballguy45 ) already create and use your own styles? |
@rikardomarenzzi @ftballguy45 I was able to add my own style in a "hacky" way. It is not the right way but it kind of works for what I need. There is some weird stuff happening with the fonts with this method. I haven't really devoted time to figure out the fonts. Also, I am assuming you already have an mbtiles file and are using opemaptiles. The fast explanation:
Note that you pretty much have to do steps 3-5 every time you start the tile-server because server is deleted when closed. The long explanation is below: Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Hope it helps. I might try a figure out a better way but this was good enough for me. Update for step 3:
Update for dealing with font glyphs:
What I will try to do in the future:
|
It seems like this issue got me hooked because I can't stop working on it. Ok figured out how to get a bunch of different styles with the tile server. Follow the steps above and create the tile server however you like. I will use the long docker command rather than Instead of copying the custom style.json file into You can put a bunch of different directories with different styles. Just make sure the glyph and tile source paths are correct. Also make sure to restart the server any time you change something inside the container. Hope it is clear. Good luck. Maybe someone explains how to start the tile server with a desired style. |
----New update---- I started looking at some of the mapbox styles from their website, like Decimal and Frank. I could not get the map to render correctly using the *.mbtiles file that I generated locally from openmaptiles. Basically, the server was running fine for these styles but the map was not rendering any glyphs, sprites and some layers. Pretty much only the background was visible. However, if I change my source url to the one recommended by the particular style (a mapbox tileset) then everything worked fine. The obvious difference is that I am not using the tiles I generated. Also, now it is subject to the mapbox api requests limits. If you want easy control over your tiles and styles it is better to just create a fresh style with maputnik and make sure you are using maptiler as the source since those tiles are compatible with openmaptiles. Why don't mapbox styles work with tiles generated from openmaptiles? Openmaptiles and maptiler use the same tile layer scheme. Mapbox has a similar yet different standard. If you try to use your openmaptiles *.mbtiles file with a mapbox style, you might not get any errors but the map will not render what you want. You should manually change the mapbox style.json, like in maputnik. There you can manually change the source, layer names, and filters so that they are compatible with openmaptiles. This will be a tedious process but maybe it is worth it, up to you. I guess it might take a similar amount of time as starting with a clean style.json file. You would also need to figure out your sprites and glyphs and make sure the style.json is reading the sprite sheet correctly. Another way that might work would be to use openmaptiles-tools and change the layer scheme so that it matches mapbox. But this way seems way too complicated for me. |
@amorfinv Thanks for your reply. Really appreciate. Follow all the steps, it works, to restart the container, I did,
Will try out the other ways you mentioned later. |
This is driving me nuts, I have the same problem as @zcemycl - my styles show up blank (mostly). Even if I download the "basic-preview" style directly from the default, and reuse it (without changing a single line), basic preview ends up being blank...except at zoom 0. Then land borders, and water show up. has anyone else encountered this? @amorfinv (tagging you since you seem to have gotten the farthest) |
Hey @BBoldenow , That is a bit strange. It sounds like your data is incomplete (mbtiles file)? Can you a bit more specific explaining what you have tried? I finally figured out a way to start the tileserver correctly without the "hack". Currently working on a tutorial for it. I am hoping to finish it in a week or two. It will be here once it is finished. -Andres |
Thanks for all of your effort with this. I actually got it mostly working this morning - it works for vector tiles, but not raster tiles (and raster is what I'm really after, so I'll need to sort that out). I'm happy to explain what I did. First off, I did not add a directory to: /app/node_modules/tileserver-gl-styles/styles This is probably the main difference between what you explained in your post and what I did. I was having permissions issues with adding a new directory, so I just decided to modify the config.json to add the new styles. My config ends up looking like this: { As a result I need to add fonts to my data's root directory, which causes my directory structure to look like this: data I am not 100% sure what's going on with the raster tiles - I would think it uses the same data, but raster tiles are definitely not there (except at zoom 0). Vector tiles seem to work as expected though. Hours later and I still haven't sorted out the raster generation. So if anyone figures that out let me know please. |
I think adding the directory was my way of hacking the tileserver since I did not know how it worked before...I think the way you are doing it is better and the correct way. Good to hear you made some progress. That is weird about the raster tiles. I am not sure what could be wrong with it. |
@amorfinv - I have this totally working now, so if you want a 2nd pair of eyes on your tutorial, let me know. |
Awesome..Yeah that would be cool..I haven't gotten around to it this week...but hoping maybe I can continue tomorrow |
Hello @BBoldenow and everyone else in this thread. I made a tutorial for custom styles for vector tiles. See here. Still needs some through proofreading I hope this can close the issue. |
@amorfinv - I'm happy to read through it for you, but this is something I also got working. Sorry I didn't see your comment earlier! |
@amorfinv - This looks good to me. It's a lot more in depth than just styling, but good stuff. |
The Maputnik editor is a great tool to build a style in a easier way https://maputnik.github.io/editor/#0.84/0/0 |
There may have been changes to the docker images over time, so the instructions that worked for some people may not be working now. In the end I extracted the default configuration by getting into the container and running Starting tileserver-gl v3.1.1 No MBTiles specified, using tiles.mbtiles [INFO] Automatically creating config file for tiles.mbtiles [INFO] Only a basic preview style will be used. [INFO] See documentation to learn how to create config.json file. { "options": { "paths": { "root": "/app/node_modules/tileserver-gl-styles", "fonts": "fonts", "styles": "styles", "mbtiles": "/data" } }, "styles": { "basic-preview": { "style": "basic-preview/style.json", "tilejson": { "bounds": [ ... ] } } }, "data": { "v3": { "mbtiles": "tiles.mbtiles" } } } The |
Is there documentation (step by step) on how to add other styles (from MapBox) when running the Docker?
The text was updated successfully, but these errors were encountered: