-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perform dissolve on self-intersecting polygons #249
Conversation
I tried this last night and it seems to work really well! If you patch it into https://github.com/systemed/tilemaker/blob/master/src/read_shp.cpp#L248 then it can fix geometries from shapefiles too - there's a faulty one in the coast around Britain which this successfully fixes. |
I will do that hopefully tonight. |
Have a try |
Working well on the UK and France too - I tried it on the France extract (which has eight gazillion buildings) and it worked well. In particular, the lost polygon in Brest from #242 seems to be fixed! Only issue I had was that it terminated badly with france-latest.osm.pbf:
This was after the .mbtiles had been written so no real effect, but still I wonder why it's doing that. |
Probably in the deallocation of memory with this mmap allocator. At exit all shared pointers and data structures are released |
Maybe it attempts to delete the directory before all deallocation is done. You can try disabling deallocation in the memory manager. |
I think the polygon from #242 is not visible with the default style. It is landuse military. This is not exported with openmaptiles process? |
I also pushed a fix for closing the mmap file in this PR, and now perform all corrections using the dissolve. |
Hello, You are right, here is my adapted process file that includes military:
I am on my way to run this PR to check if it helps ! |
I will have to do some more investigation, right now it seems that my way is still having problems. I've seen something strange however, my run time went from 8 to 47min ! It took a lot of time reading a shapefile (ne_10m_ocean.shp). I will do some more tests on this on the next days and I will comment here ! |
Yes, the dissolve can take a lot of time. Also, boost geometry correct takes a lot of time, i think most of the time of the input process. I profiled this once. But that is a big difference you mention. I think the dissolve should use an rtree, some complex polygons are in these shape files. |
Boost geometry is actually used by mysql: I found a dataset invalid polygons: And added this to my boost/geometry/correct: Would be nice if it someday would become a mysql makevalid |
I am using an rtree for calculating the intersections now, this should be faster |
Latest code run successfully with both UK and France:
With France I was using the mmap store and got an exception (Boost 1.71) at the end of processing:
This doesn't affect anything because the tiles were already generated; there seems to be a bit of commentary on StackOverflow etc. from other people who've encountered this, so maybe just catching that error would work. It might be good to apply the dissolve fix to
But that's not urgent and we could do it in a later PR. |
What was the path that you used for the osm_store ? |
Just |
ah ok, yes, remove_all tries to remove all files/directories below /media/ssd and /media/ssd itself. Maybe it would be good not to use remove_all, but rather track the files that are actually created. I am bit scared tilemaker is going to delete any files of the user on disk... |
That might be because /media/ssd is a mount point ? |
I think this is good to merge - shall we go for it? |
There is interest from boost geometry to add a feature like this to boost, have a look at the discussion here: I have made some extra improvements to the correct, based on this. I can merge them into this PR. I don't think you will need all improvements that will come out of the boost/geometry discussion. They are probably very specific details. There is still one change I would like to merge, so please wait with merging :) |
Have a try, i pushed this last small change :) |
Moving towards 2.0 release, i would say ? |
Yes, definitely. I've set a deadline of State of the Map 2021 (9-11 July) for 2.0 :) Just running a final test and will merge this afterwards, all things being equal! |
can you still host a workshop there ? or is too late to enter ? |
Too late for a workshop, but I've signed up for a lightning talk: https://wiki.openstreetmap.org/wiki/State_of_the_Map_2021/registration_lightning_talks |
We're good to go! Merged. Thank you for an absolutely outstanding contribution. Really good to see the interest from Boost.Geometry too! |
Yes, it will probably be a long process with boost geometry. |
I think commit db992ce limits the performance quite severly, you might want to revert this |
@QuentinC can you try if the performance is still acceptable ? If the performance is not back to very slow again ? |
It seems to be running fine here, last try has been done in 9min so no issue for me ! |
Have a try to see how it works, on my 'Deventer' export, it actually helps. This polygon which was causing rendering issues on the tile, it is repaired and no rending issue.