Hi everyone, currently i'm working on my own .net implementation of a tiles server. I've made some progress but currently im facing a problem with gaps in the rendered lines (example motorways) Look at the image, there are gaps in the blue motorway. I'm rendering data based on the nodes and ways relations imported to my custom database. Any ideas what am I missing? I've already tried to include all types of 'roads' to my query. Thank you for any suggestions :) Here is the db structure, and a query answering scai's question So yes, all nodes seems to be imported correctly. and yes i am debuging the problem already for 2 days :) : How data is rendered on the tile: i'm using this http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#C.23 to get lat and lng for each tile number (left top corner). Getting the +1 tile geoposition gives me right bottom corner. Let's call those two beginingGeoPosition and endGeoPosition. that gives me a set of nodes and their lat and lng. Knowing my tiles are 256x256 i can get a pixel possition for each node on the tile:
(currently it will work only for lat and lng > 0, but thats not the point) so that gives us groups of points (for each way) on image tile positioned by their x and y. connectiong those points gives us a part of a motorway. Precisly in .net
and the full query looks like this.
asked 24 Aug '17, 09:36 michal_poz
showing 5 of 9
show 4 more comments
|
The gaps in the highway seem to be suspiciously correlated with boundaries between tiles. This might be useful for debugging your problem. In particular, you write:
To render the section of a way that is within a given tile, you need at the very least one additional node beyond the border of the tile. Otherwise, the parts of the way that cross over into the adjacent tile will be missing. So if you indeed only query for nodes within the tile boundaries, this might explain the broken highways. answered 24 Aug '17, 16:34 Tordanik 2
I've tested it and that is what is cousing the problem When a single node is not returned in the query for a specific way and lat/ lng range im getting a gap on the edge of a tile. I've tested it by creating a query that returned data for 9 tiles (one tile that i am interested in and 8 other around that first one). That gave me a image with size 768x768 px (3 x256 = 768) and all roads were drawn correctly. So now i have to figure out how to add a additional point on the edge of a tile, that would make roads align with eachother.
(27 Aug '17, 12:58)
michal_poz
1
I've just got it working correctly. By querying db for data for all 9 tiles and drawing just the middle tile using all nodes. Its possible becouse .net graphic DrawLine method allows to pass also points with x/y possition less than 0. The line is just drawn and ends at the edge of an image. Rendering lasts a big longer but i've added a caching mechanism Than you all for your comments and help He is the result.
(27 Aug '17, 15:36)
michal_poz
|
Please tell us at least the location or ideally the way IDs that won't get rendered.
For example i'm issuing the problem for 52.319371, 15.494535 I think the problem is about connecting the ways. I'm drawing roads for nodes (lat and lng) grouped by wayid, so one line on my img is build of connected points (nodes lat lng) in one group.
This seems to be around http://www.openstreetmap.org/way/223282681 and there doesn't seem to be an obvious correspondance between ways in OSM and what is missing.
You'll need to describe in more detail what you have actually done to stand a chance of anyone being able to reply with useful information.
Maybe it helps to (re-)read about the basic OSM data model, i.e. https://wiki.openstreetmap.org/wiki/OSM_XML and https://wiki.openstreetmap.org/wiki/Elements.
For example, it's exactly this line http://www.openstreetmap.org/way/497464371#map=14/52.3202/15.4986 that is not rendered correctly.
And to be more precise about what i alerady did: I've created db with tables that describes relations betwen nodes, ways, way tags (waytags values). Each node has its lat and lng.
I've also created a api that provides an endpoint for z/x/y parameters. So based on z x and y (zoom and tile number) i can get the lat and lng coordinates.
After that i can query my db getting all nodes betwen begining lat/lng and end lat/lng. It's a join query on ways and waytags so i get nodes for specific waytag value. In our discusion its highway = motorway It gives me all nodes between left top corner and bottom right corner of specific tile.
Then i know that my tile is 256x256 px, so based on node lat and lng i can specifie its position on the tile - that gives me an array of points (nodes) so i can create a polyline which is drawn on my img.
Hope it's clear enought what i just wrote. I could also post a quere here if that would help. Thanks again
That's not really enough detail - you know the schema, so you'll need to debug it. Also you've not said how the data once retrieved from the database is turned into a tile.
Then start debugging your software. Does way 497464371 and all corresponding nodes exist in your database? Does it get selected for rendering? What does the renderer finally do with it?
I've added some more precised description to the topic on how i am drawing roads. Besides that...shouldn't i use relations that are grouping ways? i mean the relations in the osm xml file
@michal_poz, have you had the time to test the hypothesis in my answer below? I posted it within minutes of your edit, so maybe you've missed it. Let us know if you're still seeing this problem!