You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to merge features automatically into a single one.
Either is not documented, or I could not find how to do it.
For example: say I have a vector of polygons extracted from a shape file, and I want to create a single polygon features with multiple parts. Is there a way to do that easily?
I could just do it by manually merging the polygon points calculate the parts and windings, but it is very tedious and error prone.
Is there a way I can do something like Shapefile.Polygon(::Vector{Shapefile.Polygon}) and automatically generate a new polygon with the correct parts and offsets?
If the Writer API is the way to do it, it's not at all clear the correct way to do this, since the geoms argument already expect a geometry iterator.
The text was updated successfully, but these errors were encountered:
Shapefile is just for reading and writing, not manipulating. But it will write any kind of geometry objects so you don't have to make the native ones like you describe.
I would use GeoInterface.jl methods and wrappers to reorganise, never work with these geometry objects directly, as you say it's tedious. They're just made to represent Shapefile objects close to how they come from disk. GeoInterface and GeometryOps.jl makes it pretty easy because you can use any compatible objects together.
(And note that Shapefile polygons are already multipolygons in the modern standards sense.)
import GeometryOps as GO
import GeoInterface as GI
# Get a vector of Polygon from whatever you pass in
polygons = GO.flatten(GI.PolygonTrait, your_polygon_vec)
# Make a MultiPolygon from them
combined = GI.MultiPolygon(polygons)
I must have misunderstood the scope of this package. I apologize.
I guess this is not supposed to be used directly then, sort of a first and last mile package when manipulating "geometric shapes".
Thank you! I'll close this issue then.
Still, it might be valuable mentioning (for future clueless visitors like me) that manipulation should be done with packages higher up in the chain somewhere in the readme :)
Hello,
It would be nice to be able to merge features automatically into a single one.
Either is not documented, or I could not find how to do it.
For example: say I have a vector of polygons extracted from a shape file, and I want to create a single polygon features with multiple parts. Is there a way to do that easily?
I could just do it by manually merging the polygon points calculate the parts and windings, but it is very tedious and error prone.
Is there a way I can do something like
Shapefile.Polygon(::Vector{Shapefile.Polygon})
and automatically generate a new polygon with the correct parts and offsets?If the
Writer
API is the way to do it, it's not at all clear the correct way to do this, since thegeoms
argument already expect a geometry iterator.The text was updated successfully, but these errors were encountered: