[postgis-users] ST_Simplify
Kevin Neufeld
kneufeld at refractions.net
Fri Oct 22 10:59:08 PDT 2010
That's what I thought ... my morning coffee hadn't kicked in yet :)
It still looks like PostGIS might benefit from a
ShiftCoordinates(linearring geometry) function to solve this particular
problem.
-- Kevin
On 10/22/2010 10:45 AM, David William Bitner wrote:
> D-P simplification is not going to modify your start/end points. For a
> bit of reference on the Douglas-Peuker simplification algorithm, see
> http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
>
> On Fri, Oct 22, 2010 at 11:13 AM, Kevin Neufeld
> <kneufeld at refractions.net <mailto:kneufeld at refractions.net>> wrote:
>
> I don't see any pdf posted, but that's ok, I get the idea.
>
> Isn't that interesting. To me, this looks like a robustness issue
> with ST_Simplify. Here, the starting point of the polygon's
> exterior ring is not on the corner.
>
> select
> st_astext(
> st_simplify(
> 'POLYGON ((
> 25 300,
> 275 300,
> 300 300,It
> 300 275,
> 300 25,
> 300 0,
> 275 0,
> 25 0,
> 0 0,
> 0 25,
> 0 275,
> 0 300,
> 25 300
> ))', 1
> )
> );
> st_astext
> --------------------------------------------------
> POLYGON((25 300,300 300,300 0,0 0,0 300,25 300))
> (1 row)
>
> I don't know why, but I too was expecting to see something like:
> POLYGON (( 0 300, 300 300, 300 0, 0 0, 0 300 ))
>
> You almost could use a function that shifts the ordinates in the
> exterior linear ring ... you could probably put something together
> fairly quickly in plpgsql (extract the exterior ring, use
> ST_GetPointN and ST_SetPointN, and rebuild the polygon).
> Once shifted, the starting ordinance would be on the corner and
> the (25 300) vertex would disappear with a rerun of ST_Simplify.
>
> JTS has the same issue.
>
> -- Kevin
>
>
>
> On 10/22/2010 2:33 AM, lplateandy wrote:
>
> Hi Kevin,
>
> Hopefully the attached (hopefully) PDF will help to show what
> i mean.
>
> In producing the PDF i think i can see why the issue happens.
> It seems that
> the start and end point of the polygon geometery are the node
> i was hoping
> might be removed during the simplify process.
>
> Not sure if there is a way around this?
>
> I do realise there are ways for a simple rectangle etc to fix
> this but the
> example is mainly for illustration as the issue is a problem
> in more complex
> geometries.
>
> Thanks
>
> Andy
>
>
> Kevin Neufeld wrote:
>
> Hi Andy,
>
> Can you post a small example?
> -- Kevin
>
>
> On 10/21/2010 10:02 AM, lplateandy wrote:
>
> Hi,
>
> I have, in the simplest example, a square polygon of 1
> by 1 kilometer
> size
> with nodes every 25 meters.
>
> I can use ST_Simplify (the_geom,5) to remove most of
> the points.
>
> However, for some reason i end up with the four corner
> nodes and a fifth
> node 25m clockwise from the top left corner.
>
> In itself, this would be fine - 5 nodes is better than
> 160.
>
> However, on some of the polygons, there are more
> complex boundaries which
> i
> wish to smooth out using simplify. I would do this
> with ST_Simplify
> (the_geom,26) example - going over the minimum 25
> metres between any
> nodes.
>
> In the example of the square with 5 nodes, the problem
> i find then is
> that
> the top left node is removed and the one 25m clockwise
> remains. The
> result
> is that i no longer have a 1km square but sloping
> Western boundary
> correctly
> going 1km North South but incorrectly veering across
> 25m to the East.
>
> Is there a way to remove the stray node so i am more
> likely to maintain
> my
> overall polygon shape. I did try
> st_simplifiypreservetopology but saw no
> noticeable difference.
>
> Hope that makes sense, any help much appreciated
>
> Andy
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> <mailto:postgis-users at postgis.refractions.net>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> http://old.nabble.com/file/p30027046/ST_simplify_issue.pdf
> ST_simplify_issue.pdf
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> <mailto:postgis-users at postgis.refractions.net>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
>
> --
> ************************************
> David William Bitner
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101022/5132efcd/attachment.html>
More information about the postgis-users
mailing list