Opened 10 years ago
Closed 7 years ago
#3113 closed enhancement (worksforme)
Add curve support to ST_Simplify
Reported by: | aaime | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.9 |
Component: | postgis | Version: | 2.1.x |
Keywords: | Cc: |
Description
Currently ST_Simplify does not support geometries with circular segments, extend it so that it does.
Intuitively, it would seems that the function should check internally if the geometry is curved, if so, first call ST_CurveToLine and then simplify as usual. The tricky part is probably to figure out the right amount of segments per quarter of circle, I guess one would have to walk the geometry, locate the circle with the biggest radius, find the number of segments that makes the linearization error smaller than the simplification tolerance, and then simplify. Or… just have some code that does the determination arc of circle by arc of circle, which is going be more efficient in term of number of generated points.
Change History (5)
comment:1 by , 10 years ago
comment:2 by , 9 years ago
Milestone: | PostGIS 2.1.8 → PostGIS 2.1.9 |
---|
comment:4 by , 9 years ago
OK, two cases here: the tolerance value is smaller than the size of most arcs, in which case just simplifying the linear bits might make sense, and linearizing the arcs first would be a Bad Idea. Second case, the tolerance value is much bigger than the arcs, so they should get wiped away and replaced… by what? Here linearizing at least forces a common logic onto the whole problem. Trying to reason about DP and arcs doesn't work so good, since DP assumes you can fit the inputs into a linear sleeve.
comment:5 by , 7 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
This is quite old and I'd like to know if aaime still really wants it. If not I'd rather close it and wait for someone else to have the need that implement a fugly bit of logic just for giggles:
- for each arc, if the radius is < tolerance * X then linearize it at tolerance/Y
- run DP on the result, skipping the remaining arc parts and retaining them unchanged
The above would I think achieve something like a "somewhat smaller thing that respects the shape of the original" which I guess is the st_simplify contract
I dont' think ST_Simplify should ever turn curves to lines. The reason to call ST_Simplify, generally, is to reduce the number of vertices. Curves already have less vertices than lines so why move from curves to lines ?
How about just leave the curves as they are and simplify the linear parts ? Caller can always decide to ST_CurveToLine before feeding ST_Simplify…