Opened 5 years ago

Last modified 2 years ago

#1046 new defect/bug

Behave gracefully when supplied with overlapping binfile maps.

Reported by: tryagain Owned by: KaZeR
Priority: minor Milestone: version 0.5.1
Component: core Version: git master
Severity: normal Keywords: multi maps, binfile, routing
Cc: michael@…, fre.labrosse@…

Description

Android map download feature allows user to download map pieces by country or, for some countries, region.

Currently, if user have downloaded more than one map, he will be hit with strange navigation behavior (a misleading message would be spoken at each crossing) and duplicate search results. Other unwanted results may be seen.

Binfiles downloaded from the map server consist of tiles extracted from the planet binfile. So even if two map areas requested from the map server do not visually overlap, they usually would contain some duplicated items belonging to tiles of few top levels.

Similar problem was discussed at #1039, but that one was caused by a different case, the same map file were used twice by the navit android port.

I don't think we have any chance to compose a perfectly working map if user would have randomly downloaded parts built from different planet.osm versions.

But if we put additional assumption that all maps are built nearly at the same time, I see some options to consider.

For example, we could remember osm ids of all objects proccessed from the mapset and skip duplicates. This one seems to be too memory hungry and still doesn't solve the case when we have two different versions of the same object.

Another way is to remember only tile names processed and skip whole duplicate tiles. This seems to be the best solution. But it will break situation if user has intentionally overlapping binfiles of different origins. For example, usual osm based binfile and one built from the third party POI data. So we need some way to mark binfile origin. Additional <map> tag attribute should be sufficient.

It would be useful to have some warning if user has binfiles (to be precise, tiles) of same origin and [significantly] different timestamps.

I think, maptool also could be modified to produce all tiles with same timestamp so we can always be sure if two tiles are the same.

Change History (15)

comment:1 Changed 5 years ago by mvglasow (2)

  • Cc michael@… added
  • Summary changed from Bheave gracefully when supplied with overlapping binfile maps. to Behave gracefully when supplied with overlapping binfile maps.

As a quick fix, how about simply suppressing the superfluous turn instructions?

If I get it correctly, the problem occurs whenever

  • two or more binfiles containing the same tile are loaded
  • the user passes a node where one way ends and another one begins, but the road just continues (which happens every time an OSM attribute such such as bridge, tunnel, maxspeed etc. changes)

Such cases should be fairly easy to detect because of the following:

  • The point at which the maneuver occurs is the endpoint of all ways of which it is a member.
  • The list of ways involved contain exactlys two OSM IDs.

If such a case is found, just eliminate the turn instructions from the list and examine the next one.

This issue gets more and more serious because map files are getting too big for certain boundaries. For example, a map rectangle comprising the entire EU exceeds 4 GB in size and no longer fits on a FAT32 volume (which is the USB storage format on most Android devices).

comment:2 Changed 5 years ago by tryagain

Hi!

Good idea, but it would be better to analyse for duplicate edges while the routing graph is built, to reduce its complexity. Having overlapped tiles currently has heavy perfomance impact.

AFAIK osm wayid info is skipped from the routing graph while it's built, so comparing by osmway id won't be an option at that stage.

But fortunately, here's no sense to have totally identical (by lengts, access flags, endpoints) edges in the roting graph, regardless if they have same OSM Wayids or not. So we can just skip such edges while the graph is built.

As a workaround (which might be a primary solution) we have a way to split the map region into pieces not having duplicate tiles. At http://maps.test.navit-project.org you can download your selected region as a set of map files each not exceeding given size limit.

tryagain

comment:3 Changed 5 years ago by tryagain

  • Priority changed from major to minor

The routing and navigational issues are fixed with r5334

We still have duplicate results in POI search, extra resources are required to display overlapped areas by graphics code.

Are there any other known issues?

I feel we can lower the priority to minor now.

comment:4 follow-up: Changed 5 years ago by mvglasow (2)

Both approaches look good to me (in fact, I had an afterthought of reducing the route graph before building, as there are some corner cases which my suggestion would not have caught).

However, after upgrading to r5334 Navit stopped calculating routes altogether (tried on short routes within the city). When I closed Navit, downgraded to r5333 and restarted, I got a route within a few seconds.

There seems to be some bug in r5334...

comment:5 Changed 5 years ago by tryagain

Ups.

Can you please specify your map details (which area, where you have get it from, how is it old, do you use one or more maps at the same time) and platform?

Does turning the Route Graph map on sched some light on what's going wrong (attach a screenshot of a short route not being computed together with its coordinates or osm id of some way on it)?

I have retested it with current svn navit/android (self built), with default config. It routes for me well.

Last edited 5 years ago by tryagain (previous) (diff)

comment:6 in reply to: ↑ 4 Changed 5 years ago by fred labrosse

Replying to http://wiki.navit-project.org/index.php/user:mvglasow:

However, after upgrading to r5334 Navit stopped calculating routes altogether (tried on short routes within the city). When I closed Navit, downgraded to r5333 and restarted, I got a route within a few seconds.

Just drove about 150 miles with r5337 and did get random failures at routing. I started with a route, which then was lost (I was driving on the correct road, the route just got lost). It then took a long time (many miles) to get a route again. Navit was retrying every few seconds but failing. This happened several times and seemed random.

I'm not sure but I think I saw that several times it got a route while the GPS was positioning me on a small side road.

Fred

comment:7 Changed 5 years ago by fred labrosse

  • Cc fre.labrosse@… added

comment:8 follow-up: Changed 5 years ago by mvglasow (2)

@tryagain: I'll try to reproduce, but I encountered the error while on vacation, 1600 km away from home, and have since returned home. I'll see.

@fre labrosse: In the case you described, could it be that from time to time Navit determined that your position was slightly next to the road rather than on it? This may happen if the GPS signal is weak (I've had it a couple of times) and is an unrelated issue. I've opened #1093 for that.

comment:9 in reply to: ↑ 8 Changed 5 years ago by fred labrosse

Replying to http://wiki.navit-project.org/index.php/user:mvglasow:

@fre labrosse: In the case you described, could it be that from time to time Navit determined that your position was slightly next to the road rather than on it? This may happen if the GPS signal is weak (I've had it a couple of times) and is an unrelated issue. I've opened #1093 for that.

I don't think it was because (1) navit was putting me on the road at these points (when it was failing to compute a route and (2) even when I'm off the road, navit gives me a route when it succeeds (straight to nearest road and then from there). It was not taking a long time to find a route, it was failing. I'll try to reproduce that on the same computer at some point.

comment:10 Changed 5 years ago by tryagain

Hi!

There's actually a bug in r5334, which makes navigation broken when you have a route built over multiple overlapped maps.

Problem happens only when you navigate on the road having a duplicate and it looks like navit just looses the route and tries to build it over and over again. And it doesnt reproduceable with demo vehicle.

I'll revert the change as soon as I get to my dev environment (tonight), unless I get some fresh idea how to fix it by that time.

Sorry for inconvenience i have caused.

tryagain.

comment:11 Changed 5 years ago by mvglasow (2)

Just did some quick tests (still on r5333) with a split binfile containing the entire EU, things look good. Plus, the test download site has the benefit of actually displaying the download link so I can bookmark it and download the same map again.

Splitting the map is probably the best way to go - no data duplication and no waste of precious storage space; overlapping maps are kind of ugly and the only reason I had for using them is that a single binfile of all countries I'm interested in is too large.

comment:12 Changed 5 years ago by tryagain

I have reverted back r5334 with 5338, so now navigation should work as before, you would get excessive insructions if you have more than one overlapped map.

The issue was caused by the fact that route_set_position/route_set_position_from_tracking would use a closest item from the random map, and that selected item could be skipped from the route graph. In the latter case route gets rebuild over and over again.

Function route_set_position seems to be easy to fix by dropping found streets which are not in route graph if we can find the one which belongs it.

Function route_set_position_from_tracking seems to be more complex case, because it depends on tracking code which knows nothing about route graph.

I think it would be a possible solution to make route_segment_data possible to store more than one item re at a time, thus reducing graph size and filtering out unnecesary announcements while keeping ability to continue from any of item.

It looks to be smart idea to lookup route path data for the closest street. And unless we gone more than threshodl, don't even touch other sources. Same for tracking.

tryagain.

comment:13 Changed 4 years ago by usul

  • Keywords multi maps binfile routing added
  • Milestone set to version 0.5.1

Needs to be reviewed for current SVN and IMHO fixed.

comment:14 Changed 4 years ago by fred labrosse

  • Severity set to normal

Hi,

I updated to svn a couple of days ago and downloaded maps for the UK and France yesterday. I then tried it on a short local route only to find that the same old behaviour of announcing many turns when there are none is still there. I thought this was fixed?

Fred

comment:15 Changed 2 years ago by mvglasow (2)

Project HighFive?, which got merged a few months back, should have fixed this for cases where there's a precise overlap. When two segments have the same endpoint and the same bearing at that point, they are treated as one.

What remains problematic are cases where the overlapping area has two different map versions, with road layout differing slightly due to edits. This would be hard to filter out, though.

Note: See TracTickets for help on using tickets.