-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Design Proposal: Expanding tileSources bounds #60
Comments
That is an interesting proposal, thanks @pramilk for writing it. If I understand correctly, this design would allow you to make a tile pyramid where arbitrary sub-pyramids are missing. Could it not be a problem that this design is too generic? Also if I remember correctly some people from Esri wanted to have exactly this functionality in MapLibre GL JS. Let me reach out to them... |
@pramilk can you please add an example for the way you are using MapLibre now for case 1 and case 2? That way we will make sure we are on the same page, by fully understanding the use-case. |
I think this is a very interesting proposal, thanks!
|
@wipfli, Yes it gives flexibility to uses who require this functionality without impacting any existing users. Please see my example /scenario in below example.
@ovivoda, @wipfli Use case for bounds exclusion:
Use case for multiple inclusions:
Use case for multiple inclusions:
Blue layer in this image represent coverage.
@HarelM |
There was a comment in the shack channel about tilejson specification that will need to change as well, @pramilk can you please check this aspect? |
Could this design also be used with many bounds? For example say I want to show high details for train stations globally up to z18, while the rest is z14. |
Can includes and excludes be nested? |
As @HarelM said it might be that this needs an extension of the TileJSON specification, see https://github.com/mapbox/tilejson-spec. It is an open specification and I think we should aim to contribute to it. But let us first figure out how to do it here and then bring that idea to the TileJSON repo. For completeness let me mention that MapLibre has forked the style specification and the rendering engines MapLibre GL JS and MapLibre GL Native from Mapbox. However, the TileJSON and MVT specifications have so far not been forked. |
Ah nice, @rbrundritt from Microsoft actually brought tiled tiles to the TileJSON repo back in 2019: mapbox/tilejson-spec#58 |
There are more issues in the TileJSON repo asking basically for this functionality: |
@nyurik @stepankuzmin Do you think Martin could support such a modified version of the TileJSON spec? I am asking because I think if we change the way sources can be handled in the frontend, we should also give users the tools to create such sources with more detailed coverage bounds... cc @msbarry from Planetiler, @bdon from Protomaps, @e-n-f from tippecanoe |
A related issue recently added to felt/tippecanoe felt/tippecanoe#82 - is bounds specifications that cross the antimeridian using the 0-360 degree range. This is an addition to existing |
Planetiler just writes the "bounds" field to mbtiles metadata, and tile servers like martin construct the tilejson from that, so we'd need to decide on a standard for how to encode this modified data in mbtiles for tile servers that understand this change to handle, as well as maintaining backwards compatibility for older tile servers. Right now planetiler supports a single bounds/minzoom/maxzoom and/or a polygon file. It wouldn't be hard to extend this to support multiple regions/minzooms/maxzooms, since it the bound tests all get funneled through this one class - just need to know how to encode the metadata.
Initially the polygon testing did incur a performance overhead in planetiler, but I mitigated this by adding a preprocessing step that calculates every tile that the polygon touches at each zoom level (using a RoaringBitmap) and just test against that at tile generation time. |
Right now, based on a quick look at the code, tileserver-gl generates it's TileJSON based on what is in the mbtiles metadata. I think it depends how this changes the mbtiles file. I assume bounds/minzoom/maxzoom would still be in the mbtiles file, since that is part of the mbtiles-spec? Would include/exclude be new metadata values inside the mbtiles file? as long as bounds/minzoom/maxzoom is still in the mbtiles file, I don't think this would affect tileserver. It would however need some work to support include/exclude...if that was added to the mbtiles metadata. |
Thanks for the update @acalcutt. I did not know there was also an mbtiles specification... But good to know now, so if we go forward with the tileSouces bounds proposed here we will also want to have them in TileJSON and in the MBTiles specification I think. |
I don't see that there's any direct relationship with mbtiles here, as maplibre doesn't read mbtiles. TileJSON is essentially unmaintained and I've wondered if it's necessary to look at forking it and transferring it to an org like OSGeo. |
mbtiles and tilejson are related I think. all the information to generate tilejson from a mbtiles source comes from the mbtiles metadata. That doesn't mean Tilejson/Maplibre can't support both formats, but if someone wanted to support this from a mbtiles source, this new information would need to be in the mbtiles metadata, so the tileserver could use that info to generate it's tilejson endpoints. Just one more side note on the mbtiles-spec, it mentions bounds/minzoom/maxzoom being a requirement at some point. In a future revision of this specification, the bounds, minzoom, and maxzoom rows of the metadata table will be mandatory. https://github.com/mapbox/mbtiles-spec/blob/master/1.3/spec.md#future-directions |
I really like this idea. If you've ever cobbled together data sets with holes or weird constraints, this would help. A couple things sprang to mind. Second, do you have a TileJSON example? Sometimes it's easier to understand if you can see a real world example. Your map is great here for that. |
@sjg-wdw this is more what i was thinking with the mbtiles. If you kept old bounds/maxzoom/minzoom to keep it compliant, but added some new keywords for include/exclude, then something could be done to use them on the server side if they existed and this new tilejson format could be generated. |
Yes, I like this idea. Thinking back to some of the janky TileJSON parsers I may have written in the past, it seems safer to add keys rather than change them. |
Another issue worth mentioning/considering. Include/exclude bound ranges on tile source just means that the tiles will/will not be fetched for specific bounds. Layers will still try to render them (if they are in its zoom range). So might need a corresponding change in layers spec as well if user don't want layers to render data in include/exclude tile bounds. One of the option can be to expand the visibility property to be 'none' | 'visible' | 'constrained'. Where 'constrained' will force the layer to only render within the tile source constrain. |
My intuition is that the performance penalty for rendering empty tiles is close to zero, but I have never measured it. Do you have some numbers on this @pramilk? |
Empty tiles are probably fine in most cases. But if you're doing something weird, sometimes the absence of data can be meaningful. It's best to load things precisely if you can rather than rely on empty tiles to tell you something. How that relates to layers, though.... I think you're saying that a layer should be turned off if its source is not currently visible. But how many layers does that relate to other than background? |
Regarding performance implication of rendering empty tiles: Client still have to download them. |
+1 to forking the unmaintained TileJSON spec In practice I do not think the overhead of empty tiles is that important for end-user-facing map applications, simply because human users do not spend a lot of time looking at repetitive or empty parts of the world. Is there strong counterexamples? One issue with the constrained bounds approach is that it becomes possible to express inconsistent bounds information.
|
👋 Hi, I'm not directly involved in Maplibre but I'm working on multiple tile servers (MVT / Raster) where we provide TileJSON documents so I'll be really interested to see where this discussion goes about Strictly talking about the ref: http://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/extent.yaml |
Hi @vincentsarago. Nice, which tile servers are you involved in? |
@vincentsarago feel free to join the monthly meeting today at 8 PM CEST. We will discuss this design proposal today. Link to the zoom call is in the slack channel. |
@wipfli mostly two:
Thanks for the invite, I'll see if I can make it |
Notes from TSC meeting on April 12:
Action points:
|
I think the work should be done in a TileJSON fork, once the spec is changed, Maplibre can use those new attributes of the spec. |
wipfli/tilejson-spec#1 prepares a TileJSON spec fork. Since the original repository a) does not have a license file and b) the license in the readme is not MIT/BSD, I would like to get some advise on licensing before we actually bring this into the MapLibre org. |
It's been 5 years since I originally made the update request to the tilejson spec for this. I now have another scenario where this would useful and aligns with where MapLibre is heading, elevation tiles. I'm working on a scenario where I have a few thousand areas of interest on a map where the user will often be very close to the ground when viewing the map. In those areas I have high resolution elevation data generated from lidar data with 0.5m resolution. Most of my areas of interest are around 4 sq km's in size, but I still want to show the surrounding area with 3D terrain, but low resolution is fine, and actually preferred as I want to have an offline option. That said, this also posses a bit more complexity since only a single terrain source is supported in MapLibre GL JS at this time, and I would have different max zoom range availability for the high/low resolution data. In the mean time I'll like use combination of a request transform a custom service to bridge this gap for now. |
You might be able to use addProtocol for fetching specific areas while returning 404 for others or fetch a bigger tile and splice it and basically combining multiple sources into one custom source. |
Design Proposal Template
Motivation
Bounds property in tile sources currently takes a bound and constraints the tiles from this bound. This is very constraining and does not provide flexibility that we need. Here are the current limitations we face.
There is no way to specify a bound which should be excluded. For example in our case,
There is no way to specify multiple bounds. For example in our case
Proposed Change
Proposal is to expand bounds property to support inclusion and exclusion bound's along with min/max zoom for which these bounds will be applicable. Please look at below API modification for types.
API Modifications
Current TileJson type
Proposed TileJson with this change
Alternative option with more flexibility is to support both bounds/polygon bounds.
Migration Plan and Compatibility
It will be backward compatible.
The text was updated successfully, but these errors were encountered: