0

I am going to create polygon, but it produce invalid polygon form this data:

[[  0 438]
 [  0 428]
 [  0 427]
 [  6 428]
 [  9 434]
 [ 11 439]
 [  7 443]
 [  3 446]
 [  0 448]
 [  0 452]
 [  0 452]
 [  0 449]]

Now I want to create multipolygon from the above data. How can I create multipolygon?

1
  • In what way is it invalid? Could you add the code you are using to create it? – BERA Jul 14 '20 at 14:04
1

If I've understood correctly what you want to do this is how I did it,

from shapely.geometry import Polygon
from shapely.geometry import MultiPolygon

lat_point_list = [0, 0, 0, 5, 9, 11, 7, 3, 9, 0, 0, 0]
lon_point_list = [438, 428, 427, 428, 434, 439, 443, 446, 448, 452, 452, 449]

polygon_geom = Polygon(zip(lon_point_list, lat_point_list))
multipolygon_geom = MultiPolygon([polygon_geom])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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