Repository navigation
read from GeoJSON export of boundaries.osm - #2658
Conversation
|
A bit offtopic but the file seems to cause all kinds of weird issues in Githubs GeoJSON viewer 😅 |
… (only)" This reverts commit 5022e2b.
|
I created a converter which fixes the problems of the exported boundaries.geojson file. With the produced GeoJSON all the tests pass now. |
|
@westnordost this could also be interesting for you, since you mentioned that you contributed upstream |
|
@karussell should we run the converter as part of the maven build using exec:java? |
|
Thanks for the ping. However, I am not sure what is reported in https://josm.openstreetmap.de/ticket/22372 Regarding |
|
So maybe you want to read the *.osm file directly. This should work smoother as part of the build process too, because you do not have the manual step of opening that file in JOSM and exporting it to geojson but can directly pull the file from the JOSM repo. Here is the Java code I use, it uses JTS too: If you like to use that, you can use it and the associated tests under the terms of the Apache license 2.0. |
An update from time to time which we can manually review is better IMO. (does not seem to update too often)
Ah, ok. Yes, this is then probably the case. And thanks a lot for the hint regarding your boundaries reader and letting us use the code (and its tests!) under the Apache license, still probably we'll just use the geojson export directly. Will see how it works :) |
|
Thanks @westnordost - this works now and creating this with your tool is a better solution than the more involved process with josm and the converter before. Also less code changes are required. For simplicity I attach the generator.zip I used. |
… -> use master of westnordost/countryboundaries
|
Ok, with westnordost/countryboundaries#10 and the latest commit we can now use the unmodified version to create the countries.geojson file -> generator.zip |
easbar
left a comment
There was a problem hiding this comment.
Thanks, great news you were able to improve the country border resolution! I took a look at the code only, it seems like you already tested the quality of the new country file.
|
|
||
| private final String name; | ||
| private final String twoLetterCode; | ||
| private final String displayName; |
There was a problem hiding this comment.
displayName sounds like you need to distinguish the name and a displayName? But there is no name? Ok, maybe this String is the displayName of the country code rather than the name of the country, but then the enum should be called CountryCode... Or we need to think of Country being a country code that has a display name. Because Afghanistan is certainly the name of the country Afghanistan, and not its display name :) But it is the display name of the AFG country code (rather than its name)... Anyway, for simplicity my vote goes for Country and name :) But not so important.
There was a problem hiding this comment.
But there is no name?
I thought so too, but there is: the name() method of the enum itself and it was confusing to have getName() and name() and both returning two different things.
But I surely understand your argument regarding the name of the country. Hm.
There was a problem hiding this comment.
Ah, I see. Maybe getCountryName()?
|
Nice, thanks! |
|
Thanks to you and @westnordost + @otbutz. A lot of nice improvements since I started :) |
Fixes #2394. This seems to work (mostly) and the higher precision is indeed visible when routing and the file is even smaller :)
But there is a problem in the boundaries.osm file. The problem might be that the type of the relation member is'way'but should be'relation'to create separate Polygons inside the MultiPolygon. This leads to an incorrect handling downstream in our AreaIndex and country lookup because it thinks that there is just a single Polygon with a shell and several holes. (I think I can exclude a bug in our deserializer because when rearranging the coordinates of the MultiPolygon it reads it as expected)to do: