Polygon simplification producing GeometryCollection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Polygon simplification producing GeometryCollection

Jeff Adams-4
I have a process that iterates over all the "sides" (each pair of points in the outer ring) of a polygon.  To try and reduce the work being done, I first simplify the polygon to reduce the number of points.  However sometimes the results of the simplification are not polygons.  For example, this one:

POLYGON((2666719.2769999951 239838.80500000715,2666748.478 239922.69099999964,2666710.0569999963 239979.87600000203,2666669.5189999938 240035.15600000322,2666661.0240000039 240124.87399999797,2666601.0429999977 240175.05099999905,2666513.2670000046 240196.77599999309,2666466.6580000073 240247.43299999833,2666514.6229999959 240282.87000000477,2667466.3560000062 240145.33400000632,2667546.7150000036 240709.69799999893,2668014.5849999934 240644.20200000703,2668017.700000003 240674.24300000072,2668092.6110000014 240663.73199999332,2668488.1930000037 240608.22100000083,2668574.4849999994 240596.11200000346,2668571.2900000066 240569.4810000062,2668571.1009999961 240567.90600000322,2668812.8110000044 240534.98399999738,2669102.7689999938 240495.49099999666,2669130.5129999965 240491.7119999975,2669130.4399999976 240491.04700000584,2669130.2399999946 240489.25300000608,2669127.3610000014 240463.33799999952,2669127.0600000024 240460.62800000608,2669127.0230000019 240460.298999995,2669414.0779999942 240426.48399999738,2669413.6790000051 240425.39800000191,2669412.5359999985 240422.28300000727,2669255.8719999939 239995.45600000024,2669255.4319999963 239995.77400000393,2669159.9609999955 240064.99300000072,2669084.5 240063.46799999476,2669074.0990000069 240063.46799999476,2669073.5090000033 240063.46799999476,2669063.9200000018 240063.46799999476,2668845.9220000058 239971.23800000548,2668781.8939999938 240137.78599999845,2668694.5240000039 240156.38500000536,2668588.4280000031 240091.54799999297,2668509.1229999959 240081.87700000405,2668198.8219999969 240044.03499999642,2668198.7880000025 240044.03100000322,2668128.6630000025 240058.89499999583,2668007.4679999948 240000.58400000632,2667954.873999998 240024.59399999678,2667730.9309999943 239961.38899999857,2667581.3809999973 239994.48600000143,2667447.9140000045 239880.625,2667481.5289999992 239735.32799999416,2667415.2150000036 239669.01399999857,2667366.4599999934 239661.11399999261,2667339.7539999932 239632.04600000382,2667276.4889999926 239462.0680000037,2667203.5520000011 239413.30200000107,2666963.3330000043 239350.48600000143,2666775.575000003 239332.5380000025,2666714.7409999967 239362.61599999666,2666647.1819999963 239460.74400000274,2666674.2890000045 239642.42000000179,2666737.1550000012 239678.18000000715,2666753.8809999973 239707.59399999678,2666719.2769999951 239838.80500000715),(2666748.478 239922.69099999964,2666748.7520000041 239922.29500000179,2666748.6899999976 239923.29799999297,2666748.478 239922.69099999964))

when simplified using the TopologyPreservingSimplifier (distanceTolerance: 5.0) produces:

GEOMETRYCOLLECTION(LINEARRING(2666719.2769999951 239838.80500000715,2666748.478 239922.69099999964,2666669.5189999938 240035.15600000322,2666661.0240000039 240124.87399999797,2666601.0429999977 240175.05099999905,2666513.2670000046 240196.77599999309,2666466.6580000073 240247.43299999833,2666514.6229999959 240282.87000000477,2667466.3560000062 240145.33400000632,2667546.7150000036 240709.69799999893,2668014.5849999934 240644.20200000703,2668017.700000003 240674.24300000072,2668574.4849999994 240596.11200000346,2668571.1009999961 240567.90600000322,2669130.5129999965 240491.7119999975,2669127.0230000019 240460.298999995,2669414.0779999942 240426.48399999738,2669255.8719999939 239995.45600000024,2669159.9609999955 240064.99300000072,2669063.9200000018 240063.46799999476,2668845.9220000058 239971.23800000548,2668781.8939999938 240137.78599999845,2668694.5240000039 240156.38500000536,2668588.4280000031 240091.54799999297,2668198.7880000025 240044.03100000322,2668128.6630000025 240058.89499999583,2668007.4679999948 240000.58400000632,2667954.873999998 240024.59399999678,2667730.9309999943 239961.38899999857,2667581.3809999973 239994.48600000143,2667447.9140000045 239880.625,2667481.5289999992 239735.32799999416,2667415.2150000036 239669.01399999857,2667366.4599999934 239661.11399999261,2667339.7539999932 239632.04600000382,2667276.4889999926 239462.0680000037,2667203.5520000011 239413.30200000107,2666963.3330000043 239350.48600000143,2666775.575000003 239332.5380000025,2666714.7409999967 239362.61599999666,2666647.1819999963 239460.74400000274,2666674.2890000045 239642.42000000179,2666737.1550000012 239678.18000000715,2666753.8809999973 239707.59399999678,2666719.2769999951 239838.80500000715),LINESTRING(2666748.478 239922.69099999964,2666748.6899999976 239923.29799999297,2666748.478 239922.69099999964))

and when simplified using the DouglasPeuckerSimplifier (distanceTolerance: 5.0) produces:

GEOMETRYCOLLECTION EMPTY

Is this the right behavior?

I'm using NTS version 1.7.3.

Thanks,
Jeff

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Polygon simplification producing GeometryCollection

Martin Davis
Nope, that's definitely not the right behaviour.  This works fine in JTS
1.10 (both simplifications produce polygons).  Perhaps a bug in NTS?

Jeff Adams wrote:

> I have a process that iterates over all the "sides" (each pair of
> points in the outer ring) of a polygon.  To try and reduce the work
> being done, I first simplify the polygon to reduce the number of
> points.  However sometimes the results of the simplification are not
> polygons.  For example, this one:
>
>
> Is this the right behavior?
>
> I'm using NTS version 1.7.3.
>
> Thanks,
> Jeff
> ------------------------------------------------------------------------
>
> _______________________________________________
> jts-devel mailing list
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/jts-devel
>  

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/jts-devel
Loading...