Skip to main content
2 of 5
edited tags
PolyGeo
  • 65.2k
  • 29
  • 109
  • 340

Convert Polygon to MultiPolygon with Shapely

I'm writing code that loads data into a database. I have to do some validation/clean up of the data before inserting it. One of the requirements of the database is that this particular table only accepts multipolygons. (It's simpler to just make everything consistently a multipolygon than to try to handle the two different cases.)

I have the shape in the form of a Polygon object. I need to convert it to an multipolygon for insertion. (I would just use the SQL methods for this, but unfortunately, I'm using an ORM right now.) How can I convert the Polygon object into MultiPolygon object?

jpmc26
  • 1.7k
  • 1
  • 13
  • 30