Skip to content
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

Simplification of multi-geometries #49

Open
skygering opened this issue Jan 18, 2024 · 3 comments
Open

Simplification of multi-geometries #49

skygering opened this issue Jan 18, 2024 · 3 comments

Comments

@skygering
Copy link
Collaborator

Currently, when GeometryOps simplifies multi-geometries, it just simplifies each sub-geometry and then reconstructs. However, LibGEOS suggests that entire sub-geometries can be removed. See the example below:

import GeoInterface as GI
import GeometryOps as GO
import LibGEOS as LG

mp_coords = [
    [[[24332.448443033114, 78156.5044920507], [24335.48046004802, 78155.02337099149], [24332.100142171057, 78154.15319217058], [24332.448443033114, 78156.5044920507]]],
    [[[24721.947085257176, 80785.92121346148], [32813.95278360643, 88654.68891218181], [34573.68704928234, 87616.90783669954], [33538.70270722534, 80524.1641959386], [24414.252883053858, 78175.30137343572], [24333.793108370985, 78165.5820218308], [24721.947085257176, 80785.92121346148]]],
]

lg_vals = GI.coordinates(LG.simplify(mp, 100.0))
go_vals= GI.coordinates(GO.simplify(mp; tol = 100.0))

lg_vals is the coordiantes of a polygon, while go_vals is a multipolygon.

@rafaqz
Copy link
Member

rafaqz commented Jan 18, 2024

That wont be type stable... we can remove rings but it should always come out a MultiPolygon if it went in a MultiPolygon

@skygering
Copy link
Collaborator Author

Yeah but should it now be a 1-element multi-polygon? I honestly think it is kind of weird to just delete a whole polygon. simplify is supposed to decrease the number of points, not make a "judgment call" about the polygon size. If we both agree on that then I will close this issue.

@rafaqz
Copy link
Member

rafaqz commented Jan 19, 2024

Yeah exactly, removing polygons us a totally different thing to removing points and should be a different function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants