2

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?

Edit (example)
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)

closed as unclear what you're asking by mgri, Knightshound, Evil Genius, whyzar, Mapperz Jun 14 '17 at 19:01

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

0

I am confused because your WKT features are two distinct polygons

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.