logo separator

[mkgmap-dev] Special cases with LocationHook

From Gerd Petermann gpetermann_muenchen at hotmail.com on Mon Jul 16 08:54:58 BST 2018

Hi  Henning,

I  had to revert the changes regarding the boundary nodes for now, we have to do that after all executing the hooks.
Anyway, the attached patch seems to solve all your problems, and also some more, e.g. the highway
https://www.openstreetmap.org/way/206524724
is now correctly located in China, not im Mongolia.

A binary is here:
http://files.mkgmap.org.uk/download/435/mkgmap.jar

Changes:
- Use high precision values when retrieving values from the precompiled bounds file
- Use first or last point of a way only as last option

I think this is a more or less a work around which works quite well, the better solution might be this:
1) Find all ways that build admin boundaries, at least those for admin_level=2
2) For each point of these ways, store either the admin_level or at least a bit flag that says "is on country border"
3) In the LocationHook, prefer nodes which are not on any admin border

This probably better solution requires a lot more work and still we would not solve the problem that a way or polygon can cross boundaries.
To solve this as well we would have to
- retrieve the polygons that are stored in the bounds file(s)
- split each way so that no way segment crosses any of the polygons

This would require even more code and probably also a lot more memory and CPU time.

So, please try the work around and check if it works well for you.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Gerd Petermann <gpetermann_muenchen at hotmail.com>
Gesendet: Sonntag, 15. Juli 2018 10:35
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] Special cases with LocationHook

Hi Henning,

yes, I've already implemented some changes on my machine which help in your case:
1) add boundary nodes before calling the LocationHook
2) use high precision values of coords when retrieving the data in the bounds file

The above problems occurred while checking the side effects of these changes ...

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Henning Scholland <osm at hscholland.de>
Gesendet: Sonntag, 15. Juli 2018 09:52
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] Special cases with LocationHook

Hi Gerd.
regarding 1+2) I don't see a use case for having country information on
natural=land/sea (natural=sea I estimate is generated by
natural=coastline). But maybe others do... For my understand those are
just used for colouring the map background.

In general it would be best, to not points which are out of the tile
boundary if bounds-file is used or calculate the splitting point ( in
case of a line) with the tile boundary and then use this as end point of
the way for location hook.

Henning

On 15.07.2018 15:21, Gerd Petermann wrote:
> Hi all,
>
> while looking at the problem reported by Henning I've noticed a few special cases. Please comment:
> 1) The current code tries to set the mkgmap:admin_level? tags for generated ways with natural=sea.
> Does that make sense? Sometimes it works, esp. when the polygon is close to the coast.
>
> 2) The current code may fail to set mkgmap:admin_levelx tags  for ways with natural=land generated by SeaGenerator
> even if these polygons are clearly inside a country boundary. It happens when the generated way is outside the (calculated) bounding box
> of all nodes in input file, but inside the tile boundary. Such a tile is produced by splitter when you split e.g. Canada without
> trimming the tiles. Some tiles will cover large parts of the USA.
> This potential problem was introduced with r3861 : http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=3861
>
> Gerd
>
>
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>
>

_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: admlevel2-v1.patch
Type: application/octet-stream
Size: 10518 bytes
Desc: admlevel2-v1.patch
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20180716/a14fbf56/attachment-0001.obj>


More information about the mkgmap-dev mailing list