Reputation: 8400
How to export the results come from spatial operations such as buffer
function on points using Shapely
package for Python to a DXF file? BTW, googling wasn't so helpful this time.
Upvotes: 1
Views: 1979
Reputation: 207
One way is thanks to the __geo_interface__
interface standard and the ezdxf library.
A sample code could be below were shapes
holds your e.g. MultiPolygon
from shapely.geometry import mapping
import ezdxf
import ezdxf.addons.geo
doc = ezdxf.new()
geoproxy = ezdxf.addons.geo.GeoProxy.parse(mapping(shapes))
msp = doc.modelspace()
# Use LWPOLYLINE instead of hatch.
for entity in geoproxy.to_dxf_entities(polygon=2):
msp.add_entity(entity)
doc.saveas("test.dxf")
Upvotes: 0