I parse a geoJson file resulting in a list of
osgeo.ogr.geometry-classes (all Polygons). I also have a new one which I want to dissolve with the rest.
I'm using the ogr package in python, it does something like Union, but I was unable to get satisfying results. Does anyone have a solution for dissolving the two polygons?
A sample was asked in the comments, so here it is;
The sample-WKT is taken from Wicket. Then I simply do a union, with my expected results being one polygon representing the outline (since they are overlapping). Maybe I totally misunderstand the Union method, but would like to have a 'dissolved' result.
import ogr # exported from; https://arthur-e.github.io/Wicket/sandbox-gmaps3.html wkt_one = "POLYGON((109.86328125 -0.7745125438579877,107.40234375 -44.13885576756879,171.38671875 -47.327653995607086,165.05859375 10.071628685919348,109.86328125 -0.7745125438579877))" wkt_two = "POLYGON((90.52734375 15.554252501699544,-157.32421875 -6.7355309886055625,-146.07421875 34.24813554589752,104.23828125 44.789632547614076,90.52734375 15.554252501699544))" polyOne = ogr.CreateGeometryFromWkt(wkt_one) polyTwo = ogr.CreateGeometryFromWkt(wkt_two) print polyOne print polyTwo print "---" print polyOne.Union(polyTwo)