[PATCH v3] Mp merge: generate-sea: bugfix for generate-sea=multipolygon

Sorry, I forgot to include one class in the last patch so that it did not compile. WanMil

Hi WanMil, The v3 patch is working well with the Baltic map. The main land masses are there and I haven't yet spotted any missing islands. One issue, the boundaries of the tiles are visible on the land at all zoom levels (see visible-tile-boundaries.png). The boundaries are not visible on the sea. It's looking very promising (see mp-islands.png), well done. Mark

Hi WanMil,
The v3 patch is working well with the Baltic map. The main land masses are there and I haven't yet spotted any missing islands.
One issue, the boundaries of the tiles are visible on the land at all zoom levels (see visible-tile-boundaries.png). The boundaries are not visible on the sea.
It's looking very promising (see mp-islands.png), well done.
Mark
Hi Mark, at the moment I have no idea why tile boundaries are visible. What do you see if you zoom in? Do you see any kind of line style or is it just an empty line? I did have a visualization of the bounding box (a motorway on the bbox) but that's definitely not part of the patch. Do you have any idea what I could looking for? WanMil

WanMil,
at the moment I have no idea why tile boundaries are visible. What do you see if you zoom in? Do you see any kind of line style or is it just an empty line?
Just a line with a bluey-purpley colour. Look at the image in the last email and zoom right in to that and you will see it's just a plain line.
I did have a visualization of the bounding box (a motorway on the bbox) but that's definitely not part of the patch.
Do you have any idea what I could looking for?
Not yet. It's interesting that the line is not visible in the sea polygons. Mark

WanMil,
My workaround was based on the assumption that all polygons created by the mp code will be clipped to the bounding box later (by the style code). Can you confirm that?
Yes, polys are clipped in StyledConverter.addShape(). I looked at the output using mapedit and the land has no polygons that touch the tile edges (except for other map features like woods, lakes, buildings, etc.) So the lines are not coming from stuff in the img file. Weird... Mark

WanMil, Good news - I don't think it's your problem. I disabled the sea generation completely and the lines on the tile edges are still there. Haven't a clue what's causing them (and I don't care because they don't show up when I use generate-sea=polygons). One issue that I don't think you can do much about is that mapsource tends to show horizontal and vertical gaps between polygons when you zoom out. They are a bit weird because they come and go as you pan and zoom. Having polygons for sea (as opposed to having polygons for land, which is what I have been using) means that you get more artifacts visible when using mapsource. That's a shame but may well not be a problem when viewing the map on a real gps. Anyway, your new MP code is producing great results (and it's quick). Mark

WanMil,
Good news - I don't think it's your problem. I disabled the sea generation completely and the lines on the tile edges are still there.
Haven't a clue what's causing them (and I don't care because they don't show up when I use generate-sea=polygons).
One issue that I don't think you can do much about is that mapsource tends to show horizontal and vertical gaps between polygons when you zoom out. They are a bit weird because they come and go as you pan and zoom. Having polygons for sea (as opposed to having polygons for land, which is what I have been using) means that you get more artifacts visible when using mapsource. That's a shame but may well not be a problem when viewing the map on a real gps.
Anyway, your new MP code is producing great results (and it's quick).
Mark
Mark, thanks a lot! I did have a bad test... I generated a map of belgium with generate-sea=multipolygon,no-sea-sectors and whole belgium is flodded :-( BUT I found out that some of the coastline segments are missing or are not completely contained in the OSM dump, so that's no shame for mkgmap. I think it's a general problem that the osm dumps do not contain any detailed information about the shape that was used to cut out the OSM data. Without this shape we don't have a good chance to detect the edges and to close open polygons. Maybe we can propose this to the next version of the API? Another idea is to introduce a kind of ShapeDetector which tries to regenerate the original shape of a tile / OSM dump. I don't have a good idea how to do this and I have less idea how to do this in acceptable time. Maybe we can use an java.awt.geom.Area object and add all lines with a dimension of 1 unit. At the end of reading the OSM file we could get the outer shape from the area object. But I don't think that this is quick..... Anyhow the mp code of my patch is not the solution for all but at the moment it improves the handling of multipolygons very much compared to the current trunk. And after committing I think I will get some more feedback from other map generators which will help to improve things. WanMil

Another idea is to introduce a kind of ShapeDetector which tries to regenerate the original shape of a tile / OSM dump. I don't have a good idea how to do this and I have less idea how to do this in acceptable time. Maybe we can use an java.awt.geom.Area object and add all lines with a dimension of 1 unit. At the end of reading the OSM file we could get the outer shape from the area object. But I don't think that this is quick.....
If now working with planet files or josm extracts I think most people use geofabrik.de extracts (or has someone succesfully used the extracts from cloudmade?). Maybe someone could give them or the osmosis team - a hand in what we would need to have changed so that a) sea polygons are complete inside the extracts b) routing over extract borders work (well this if someone finds out how to get rid of the overlap for mapsource/GPS)

WanMil,
Good news - I don't think it's your problem. I disabled the sea generation completely and the lines on the tile edges are still there.
Oops, I may have spoken too soon. With your v3 patch in place, I made a new map with generate-sea=polygons and not only are the lines still there, all my sea has disappeared! Don't worry, I now think the lines between the tiles are always there on my Baltic map and I just haven't seen them before because when you use generate-sea=polygons you get polygons covering all of the map. But when you use generate-sea=multipolygon, there are no land polygons and so the lines show through from underneath. Now why they are there, I don't know at the moment (I don't think it's the fault of the MP code). However, there is still a problem in that with your v3 patch in place, I no longer get any sea polygons visible when I use generate-sea=polygons. I wonder if the change you made to the size of the sea polygons is responsible for that? Could you please change that code so that it only produces the over-large sea background when generateSeaUsingMP is true? Thanks, Mark

However, there is still a problem in that with your v3 patch in place, I no longer get any sea polygons visible when I use generate-sea=polygons. I wonder if the change you made to the size of the sea polygons is responsible for that? Could you please change that code so that it only produces the over-large sea background when generateSeaUsingMP is true?
Attached patch (against the mp branch) solves this. WanMil

On 18.01.2010 19:36, Steve Ratcliffe wrote:
On 18/01/10 18:05, WanMil wrote:
Attached patch (against the mp branch) solves this.
OK thanks, applied.
Is everyone happy that this is now a big improvement over trunk?
..Steve
Please put the extend-sea patch also into the branch... I can't add the extend-sea patch to the mp branch whithout running into problems on compiling. Only with extend-sea patch the above patch makes real sense... And then good if added to trunk, cause at least I get problems putting all the needed patches together without forgetting one...
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

On 18.01.2010 19:53, Mark Burton wrote:
Felix,
Please put the extend-sea patch also into the branch...
I am hoping that Ronny will provide a new version that includes the missing help blurb.
he did already. 4th message in the thread about the patch where he added some comments. Anyhow I think that the behaviour should become default, cause so many people use geofabrik data (is there a need to not use it?).
Mark _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Felix,
he did already. 4th message in the thread about the patch where he added some comments.
I can't see any addition to the help blurb in either OsmX... or the options file. Did I miss a post?
Anyhow I think that the behaviour should become default, cause so many people use geofabrik data (is there a need to not use it?).
I started adding options to generate-sea because I did not want to change the existing default behaviour. If this new option is to become enabled by default, we should have a "no-extend-sea-sectors" option to disable it. Mark

Hi Steve,
On 18/01/10 18:05, WanMil wrote:
Attached patch (against the mp branch) solves this.
OK thanks, applied.
Is everyone happy that this is now a big improvement over trunk?
It's performed well when processing the Baltic map. One thought, and I may be completely wrong here because I haven't looked at the "spec" for multipolygon processing, but this new MP implementation seems to have a constraint that the inner polys can't touch the outer poly(s). Is that so? and is that reasonable? After all why is it not acceptable to have a MP like this: .......*******..... .......*******..... .......*******..... ................... ................... or even more interesting: ...........*........ ..........***....... .........*****...... .................... i.e. the inner poly butts up against the edge of the outer? Are those "naughty" MPs? Mark

Hi Steve,
On 18/01/10 18:05, WanMil wrote:
Attached patch (against the mp branch) solves this.
OK thanks, applied.
Is everyone happy that this is now a big improvement over trunk?
It's performed well when processing the Baltic map.
One thought, and I may be completely wrong here because I haven't looked at the "spec" for multipolygon processing, but this new MP implementation seems to have a constraint that the inner polys can't touch the outer poly(s). Is that so? and is that reasonable? After all why is it not acceptable to have a MP like this:
.......*******..... .......*******..... .......*******..... ................... ...................
or even more interesting:
...........*........ ..........***....... .........*****...... ....................
i.e. the inner poly butts up against the edge of the outer?
Are those "naughty" MPs?
Mark
In the end I don't really care very much about what's the exact definition. There will be some mps that have touching polys. So we should try to implement it. The problem is the algorithm in the mp code that detects if a polygon contains another polygon. It works as follows: * Create a java.awt.Polygon class from p1 * Check if p1 contains the first point of p2 => This contains the first problem: The definition of the java.awt.Polygon.contains(..) method is a bit complicated (and not completely understood by me). The problem arises if a point lies on the boundary. To get more information about this study the class comment of http://java.sun.com/javase/6/docs/api/java/awt/Shape.html * Now the algorithm checks that no line of p2 intersects a line of p1. If p2 has an overlapping line with p1 this check fails and p1 does not contain p2 in the meaning of the mp code. => I think this could be easily improved. The algorithm is VERY simple. If anyone knows a good and speedy algorithm that checks if p1 contains p2 please post a reference to the algorithm so that we can implement it. WanMil
participants (4)
-
Felix Hartmann
-
Mark Burton
-
Steve Ratcliffe
-
WanMil