-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Render vector tiles from graph storage /mvt #1572
Conversation
…s what's different to usual implementation
Sounds very interesting, will have a closer look! Is this just about visualizing the route or the whole / parts of the graph ? For the purposes I was looking for in #1456 this here is my (probably still incomplete) wish list. Do you think we can do all (or most of) this using the mvt approach (<- sorry no idea atm what the possiblities/limitations are) ?
Update Looking at the screenshot it looks like the whole graph is already drawn and there is possibility for a popup showing the name of the road :) |
Whole graph
no bounding box necessary as everything that is visible is shown (for every "tile" it does a request and the server response gives MVT data)
You can actually show every data you like be it as a color or if you click on the road via a popup, yes :)
👍 ... a bit tricky from the GH perspective but easy as this should be just 2 roads we have to transmit :)
This can be easily done. And is done already. E.g. for the overview it just returns junction nodes and deeper zooms gives full way geometry
Could be color-encoded or something, sure.
As we can easily integrate this into GH Maps as overlay or basemap this should be possible like with normal leaflet functionality: https://graphhopper.com/maps/?point=41.95949%2C2.790527
Definitely possible. We could pack all data we have into the MVT and evaluate them on the client side. The current problem is for many points it takes long to convert our data into MVT on the server side. Still it already works reasonable fast, especially if you have just a few cities or even less. |
Cool!
A single or even a part of a single city would be sufficient for debugging routing problems I think.
Ok but why ? Could they not be somehow attached as metadata ? At a minimum we should be able to use an extra endpoint that serves turn restriction information (for example per node id or bounding box) and use this as an extra layer (<- can we draw an extra layer on top of the vector tiles from the client side?) |
Sorry, my wording was bad. I just meant the graphhopper part ... currently we would have to loop through all edges to find if there are turn costs instead of saying "please give me all turn cost in this area". If we have this data we can easily return this as e.g. a multiline with turn_restriction=true or something
Yes, this should be possible. But multiple layers are not necessary as we can use a single layer and evaluate properties of it feature by feature |
but with
Ok yes if we collect all data on the server with a single request we create one layer. |
Highly likely those exceptions are the result of tiles that the browser initially asked for, but then due to zoom level or bbox changes they are not needed anymore and explicitly rejected from the browser (connection dropped or something). So it should not happen if you zoom so slow that all tiles can render. Would be nice if we can somehow properly "fix" them.
Ah, thanks! (For firefox I had a minor glitched due to mixed content and so I had to replace localhost with 127.0.0.1: http://127.0.0.1:8989/mvt/{z}/{x}/{y}.mvt) |
Yes, the client usually cancels these requests. You can see that the easily in the network tab in the developer tools. |
Maybe there is an option to delay the client-side requests so not to many requests are sent before the zooming 'stops' at the point one really wants to zoom to ? |
IMHO both the client and GH work correctly. The problem seems to be that dropwizard does not catch this exception gracefully. Also see #1558 |
I really like the vector tiles. Here is an example using the devtools::install_github("crazycapivara/openlayers")
library(openlayers)
map_source <- "http://localhost:8989/mvt/{z}/{x}/{y}.mvt"
# Basic example
ol() %>%
add_vector_tiles(map_source) %>%
set_view(9.503174, 52.583026, 12) Adding some styles from here: fn <- "https://gist.github.com/crazycapivara/5efd362173604e25b985ce1cf68f2dad/raw/069281132f093ce11a874daaf6293e0397770408/gh-ol-mvt-style.js"
style <- read_js_function(fn)
ol() %>%
add_vector_tiles(map_source, style = style) %>%
set_view(9.503174, 52.583026, 12)
# Add a raster layer as well ...
ol() %>%
add_stamen_tiles("toner", options = list(name = "stamen")) %>%
add_vector_tiles(map_source, style = style, options = list(name = "gh")) %>%
set_view(9.503174, 52.583026, 12) %>%
add_layer_switcher() |
@crazycapivara nice, thanks! Here it is now also possible to include more information. On the server side you need the And on the client side you request a sub set of them, see bf3ece8#diff-fdabf1e86cc9047458301bd084fc7a8b Additionally we now include a different level of details in different zoom levels based on the road_class (OSM highway tag) (Please note that in the screenshots still a background layer is used that draws the layers like city names and road names) |
Fixes #1456
We can now render the roads in a browser for debugging purposes with an acceptable performance - will be especially interesting with #1548:
After several trials I think I got something I find interesting:
TODO:
allow to export GeoJSON alternatively (rename to /graph-explore endpoint or something)no. Use GeoJSON only for responses that are not easy to serve as tiles like shortest path trees. See also Improve pointlist output for isochrone (/spt endpoint) #1577With maputnik this gives me Error: http status 200 returned without content. Can we do better at returning 'an empty tile' ?fix later