Skip to content

Give out points of geometries #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 16, 2020
9 changes: 9 additions & 0 deletions src/interfaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ function decompose(::Type{T}, primitive) where {T}
return collect_with_eltype(T, primitive)
end

function decompose(::Type{P}, pol::Polygon) where {P<:AbstractPoint}
if isempty(pol.interiors)
return decompose(P, pol.exterior)
else
points = Array{Union{Point, Array}}[]
push!(points, decompose(P, pol.exterior), [decompose(P, pol.interiors[1]) for i in pol.interiors])
return points
end
end
decompose(::Type{P}, ls::LineString) where {P<:AbstractPoint} = ls.points.parent.data
decompose_uv(primitive) = decompose(UV(), primitive)
decompose_uvw(primitive) = decompose(UVW(), primitive)
Expand Down