Commit f6599ffe authored by Regina Obe's avatar Regina Obe

give up on complex S example and change to simpler L example

git-svn-id: http://svn.osgeo.org/postgis/[email protected] b70326c6-7e19-0410-871a-916f4a2858ee
parent 30b6497b
Style2;POLYGON((92.25 0,81 0.75,58.5 3.75,47.25 7.5,36.75 12,26.25 17.25,17.25 24.75,9.75 33.75,4.5 44.25,0 60.75,9 138.75,12 150,19.5 159.75,28.5 167.25,38.25 173.25,49.5 177,60.75 180,72 182.25,83.25 183.75,117 183.75,128.25 183,150.75 178.5,162 174.75,171.75 168.75,181.5 162,189 153,194.25 142.5,196.5 131.25,198 34.5,190.5 25.5,182.25 17.25,171.75 12,161.25 7.5,150 4.5,138.75 2.25,127.5 0.75,116.25 0,92.25 0))
Style1-thinline;MULTIPOINT(0 60.75,4.5 44.25,9 138.75,9.75 33.75,9.75 127.5,12 61.5,12 150,13.5 116.25,17.25 24.75,18 45.75,19.5 159.75,21 107.25,21 138.75,24 62.25,25.5 33,26.25 17.25,28.5 167.25,30 99.75,30 116.25,30 155.25,31.5 132,33 144,34.5 51.75,36 63,36.75 12)
Style1-thinline;MULTIPOINT(38.25 173.25,39.75 93.75,40.5 24.75,41.25 124.5,42 42.75,42.75 151.5,47.25 7.5,47.25 111,48.75 64.5,49.5 177,51 90,51.75 35.25,52.5 53.25,54 165,55.5 153.75,57 24.75,57.75 141,58.5 3.75,58.5 109.5,60 44.25,60 129.75,60.75 180,62.25 86.25,66.75 148.5,67.5 16.5,69 36.75,69 102,69 162,69.75 2.25,69.75 123.75)
Style1-thinline;MULTIPOINT(72 182.25,73.5 84,78 152.25,80.25 33,81 0.75,81 120,81 171,83.25 183.75,84.75 81.75,88.5 16.5,88.5 103.5,89.25 153.75,91.5 30.75,92.25 0,92.25 117.75,94.5 183.75,95.25 172.5,96 79.5,98.25 96,100.5 154.5,102.75 30,103.5 115.5,104.25 0,105.75 183.75,107.25 77.25,108.75 13.5,111.75 153.75,114 30.75,114 171,114.75 113.25)
Style1-thinline;MULTIPOINT(115.5 98.25,116.25 0,116.25 86.25,117 183.75,118.5 75,123 152.25,125.25 31.5,126 111.75,126.75 17.25,127.5 0.75,128.25 183,129 84.75,129 99,129.75 72.75,133.5 147.75,134.25 165,136.5 35.25,137.25 109.5,138.75 2.25,139.5 180.75,141 69)
Style1-thinline;MULTIPOINT(141.75 139.5,144 24,145.5 128.25,146.25 41.25,146.25 87.75,148.5 106.5,150 4.5,150.75 62.25,150.75 75.75,150.75 178.5,151.5 167.25,152.25 51,154.5 156,157.5 24,158.25 129,158.25 144,159.75 88.5,159.75 103.5,161.25 7.5,162 174.75,165.75 42,165.75 69.75,166.5 155.25,168 30,168 54.75,170.25 99)
Style1-thinline;MULTIPOINT(171 129.75,171.75 12,171.75 168.75,173.25 79.5,179.25 145.5,180 61.5,180.75 94.5,181.5 162,182.25 17.25,183.75 130.5,184.5 41.25,186.75 72,189 153,189.75 87,190.5 25.5,192 60.75,194.25 142.5,196.5 131.25,197.25 78,198 34.5)
Style2;POLYGON((8 6,6 8,6 194,14 194,154 14,154 6,8 6))
Style1-thinline;MULTIPOINT(14 14,34 14,54 14,74 14,94 14,114 14,134 14,150 14,154 14,154 6,134 6,114 6,94 6,74 6,54 6,34 6,14 6,10 6,8 6,7 7,6 8,6 10,6 30,6 50,6 70,6 90,6 110,6 130,6 150,6 170,6 190,6 194,14 194,14 174,14 154,14 134,14 114,14 94,14 74,14 54,14 34,14 14)
Style2;POLYGON((92.25 0,81 0.75,81 0.75,69.75 2.25,69.75 2.25,58.5 3.75,47.25 7.5,47.25 7.5,36.75 12,36.75 12,26.25 17.25,26.25 17.25,17.25 24.75,17.25 24.75,9.75 33.75,9.75 33.75,4.5 44.25,4.5 44.25,4.5 44.25,0 60.75,0 60.75,0 60.75,0 60.75,0 60.75,21 107.25,13.5 116.25,13.5 116.25,13.5 116.25,9.75 127.5,9 138.75,9 138.75,12 150,12 150,19.5 159.75,19.5 159.75,28.5 167.25,28.5 167.25,38.25 173.25,38.25 173.25,49.5 177,49.5 177,60.75 180,60.75 180,72 182.25,72 182.25,83.25 183.75,83.25 183.75,94.5 183.75,105.75 183.75,105.75 183.75,117 183.75,128.25 183,128.25 183,139.5 180.75,139.5 180.75,150.75 178.5,162 174.75,162 174.75,171.75 168.75,171.75 168.75,181.5 162,181.5 162,189 153,189 153,194.25 142.5,194.25 142.5,196.5 131.25,196.5 131.25,196.5 131.25,196.5 131.25,180.75 94.5,189.75 87,189.75 87,197.25 78,197.25 78,192 60.75,192 60.75,198 34.5,198 34.5,198 34.5,190.5 25.5,190.5 25.5,182.25 17.25,182.25 17.25,171.75 12,171.75 12,161.25 7.5,161.25 7.5,150 4.5,150 4.5,138.75 2.25,138.75 2.25,127.5 0.75,127.5 0.75,116.25 0,116.25 0,104.25 0,104.25 0,92.25 0))
Style2;POLYGON((8 6,6 8,6 50,6 90,6 130,6 170,6 194,14 194,14 154,14 134,14 94,114 14,134 14,154 14,154 6,114 6,74 6,34 6,8 6))
Style2;POLYGON((1.15 70.9,5.6 69.45,12 71.95,17.6 70.2,24 72.7,29.6 70.95,36 73.45,41.6 71.7,48.75 74.95,54 73.55,57.8 69.75,58.45 61.6,61.55 58.5,62.8 54,69.05 49.5,69.75 47.05,74.25 45.8,77.35 42.7,80.25 43.45,87.45 40.15,91.5 41.2,97.5 39.05,102.75 40.45,108 39.05,114 41.2,119.25 39.8,125.25 41.95,128.15 41.2,131.25 44.3,136.95 45.6,141.9 50.55,143.05 55.65,141.25 58.6,135.75 59.95,132.65 63.05,129.75 62.3,122.55 65.6,118.5 64.55,111.3 67.85,107.25 66.8,100.05 70.1,96 69.05,88.8 72.35,84.75 71.3,77.55 74.6,73.5 73.55,66.3 76.85,62.25 75.8,57 77.2,53.9 80.3,45.75 80.95,42.65 84.05,34.5 84.7,30.45 89.4,24.75 90.7,20.25 96.95,15.75 98.2,11.95 102,10.7 106.5,5.65 109.8,9 138.75,12 150,19.5 159.75,38.25 173.25,60.75 180,83.25 183.75,128.25 183,162 174.75,181.5 162,189 153,194.25 142.5,196.65 120.8,190.5 122.95,183.75 120.05,177.75 122.2,171 119.3,165 121.45,158.25 118.55,152.25 120.7,145.5 117.8,140.25 119.2,136.45 123,135.8 131.15,132.7 134.25,131.75 137.75,128.25 138.7,124.7 142.25,116.4 144.55,111.75 143.3,105.75 145.45,100.5 144.05,95.25 145.45,89.25 143.3,84.6 144.55,78 141.8,75.1 142.55,67.15 136.95,69.3 134.1,75 132.8,78.1 129.7,81 130.45,88.2 127.15,92.25 128.2,99.45 124.9,103.5 125.95,110.7 122.65,114.75 123.7,121.35 120.95,126 122.2,133.2 118.9,137.25 119.95,142.5 118.55,145 116.05,148.5 116.95,153.75 115.55,156.25 113.05,159.75 113.95,165 112.55,168.55 109,175.5 108.05,179.05 104.5,186 103.55,190.5 97.3,197.1 94,197.75 52.15,192 50.3,185.6 52.8,177.65 51.65,174.8 47.25,175.25 45.75,179.25 50.3,184.5 51.7,189.75 50.3,194.25 43.95,197.85 44.95,198 34.5,182.25 17.25,161.25 7.5,138.75 2.25,116.25 0,81 0.75,58.5 3.75,47.25 7.5,26.25 17.25,17.25 24.75,9.75 33.75,4.5 44.25,0 60.75,1.15 70.9))
\ No newline at end of file
Style2;POLYGON((26 179,27 177,26 170,24 162,27 157,26 150,24 142,27 137,26 130,24 122,27 117,26 110,24 102,27 97,26 90,24 82,27 77,26 70,24 62,27 57,26 50,24 42,25 41,27 34,27 27,31 27,41 37,54 40,64 38,74 40,84 38,94 40,104 38,114 40,124 38,134 40,154 14,154 6,8 6,6 8,6 194,14 194,26 179))
\ No newline at end of file
Style2;POLYGON((1.15 70.9,5.6 69.45,12 71.95,17.6 70.2,24 72.7,29.6 70.95,36 73.45,41.6 71.7,48.75 74.95,54 73.55,57.8 69.75,58.45 61.6,61.55 58.5,62.8 54,69.05 49.5,69.75 47.05,74.25 45.8,77.35 42.7,80.25 43.45,87.45 40.15,91.5 41.2,97.5 39.05,102.75 40.45,108 39.05,114 41.2,119.25 39.8,125.25 41.95,128.15 41.2,131.25 44.3,136.95 45.6,141.9 50.55,143.05 55.65,141.25 58.6,135.75 59.95,132.65 63.05,129.75 62.3,122.55 65.6,118.5 64.55,111.3 67.85,107.25 66.8,100.05 70.1,96 69.05,88.8 72.35,84.75 71.3,77.55 74.6,73.5 73.55,66.3 76.85,62.25 75.8,57 77.2,53.9 80.3,45.75 80.95,42.65 84.05,34.5 84.7,30.45 89.4,24.75 90.7,20.25 96.95,15.75 98.2,11.95 102,10.7 106.5,5.65 109.8,9 138.75,12 150,19.5 159.75,38.25 173.25,60.75 180,83.25 183.75,128.25 183,162 174.75,181.5 162,189 153,194.25 142.5,196.65 120.8,190.5 122.95,183.75 120.05,177.75 122.2,171 119.3,165 121.45,158.25 118.55,152.25 120.7,145.5 117.8,140.25 119.2,136.45 123,135.8 131.15,132.7 134.25,131.75 137.75,128.25 138.7,124.7 142.25,116.4 144.55,111.75 143.3,105.75 145.45,100.5 144.05,95.25 145.45,89.25 143.3,84.6 144.55,78 141.8,75.1 142.55,67.15 136.95,69.3 134.1,75 132.8,78.1 129.7,81 130.45,88.2 127.15,92.25 128.2,99.45 124.9,103.5 125.95,110.7 122.65,114.75 123.7,121.35 120.95,126 122.2,133.2 118.9,137.25 119.95,142.5 118.55,145 116.05,148.5 116.95,153.75 115.55,156.25 113.05,159.75 113.95,165 112.55,168.55 109,175.5 108.05,179.05 104.5,186 103.55,190.5 97.3,197.1 94,197.75 52.15,192 50.3,185.6 52.8,177.65 51.65,174.8 47.25,175.25 45.75,179.25 50.3,184.5 51.7,189.75 50.3,194.25 43.95,197.85 44.95,198 34.5,182.25 17.25,161.25 7.5,138.75 2.25,116.25 0,81 0.75,58.5 3.75,47.25 7.5,26.25 17.25,17.25 24.75,9.75 33.75,4.5 44.25,0 60.75,1.15 70.9))
Style3;GEOMETRYCOLLECTION(POLYGON((36.05 108,38.15 105.9,37.25 109.2,36.05 108)),POLYGON((39.1 104.85,39.3 104.1,39.7 104.2,39.1 104.85)),POLYGON((47.3 100.55,56.25 99.05,60.45 96.25,59.25 99.25,51.9 101.8,47.3 100.55)),POLYGON((75.3 94,80.7 91.15,84.75 92.2,89.1 91.05,88.55 93.05,83.25 94.45,78.95 100.05,75.3 94)),POLYGON((103.55 105.05,106.15 102.4,108.3 105.4,107.55 106.1,103.55 105.05)))
\ No newline at end of file
Style2;POLYGON((132 10,119 23,85 35,68 29,66 28,49 42,32 56,22 64,32 110,40 119,36 150,57 158,75 171,92 182,114 184,132 186,146 178,176 184,179 162,184 141,190 122,190 100,185 79,186 56,186 52,178 34,168 18,147 13,132 10))
Style1-thinline;MULTILINESTRING((106 164,30 112,74 70,82 112,130 94,130 62,122 40,156 32,162 76,172 88),(132 178,134 148,128 136,96 128,132 108,150 130,170 142,174 110,156 96,158 90,158 88),(22 64,66 28,94 38,94 68,114 76,112 30,132 10,168 18,178 34,186 52,184 74,190 100,190 122,182 148,178 170,176 184,156 164,146 178,132 186,92 182,56 158,36 150,62 150,76 128,88 118))
\ No newline at end of file
......@@ -510,7 +510,7 @@ MULTILINESTRING((1 2,3 4),(3 4,4 5))
<funcprototype>
<funcdef>geometry <function>ST_ConcaveHull</function></funcdef>
<paramdef><type>geometry </type> <parameter>geomA</parameter></paramdef>
<paramdef><type>float </type> <parameter>target_shrink_percent</parameter></paramdef>
<paramdef><type>float </type> <parameter>target_percent</parameter></paramdef>
</funcprototype>
<funcprototype>
......@@ -525,10 +525,12 @@ MULTILINESTRING((1 2,3 4),(3 4,4 5))
<refsection>
<title>Description</title>
<para>The concave hull of a geometry represents a possibly concave
geometry that encloses all geometries within the set. Defaults to false for allowing polygons with holes.</para>
geometry that encloses all geometries within the set. Defaults to false for allowing polygons with holes.
The result is never higher than a single polygon.</para>
<para>One can think of the concave hull as the geometry you get by vacuum sealing a set of geometries. A
target_shrink_percent of 1 will give you the same answer as the convex hull. A target_shrink_percent
<para>The target_percent is the target percent of area of convex hull the PostGIS solution will try to approach before giving up or exiting.
One can think of the concave hull as the geometry you get by vacuum sealing a set of geometries. The
targe_percent of 1 will give you the same answer as the convex hull. A target_percent
between 0 and 0.99 will give you something that should have a smaller area than the convex ull. This is different from a convex hull which is more like wrapping a rubber band around the set of geometries.</para>
<para>It is usually used with MULTI and Geometry Collections.
......@@ -536,7 +538,7 @@ MULTILINESTRING((1 2,3 4),(3 4,4 5))
with ST_Collect or ST_Union to get the concave hull of a set of points/linestring/polygons
ST_ConcaveHull(ST_Collect(somepointfield), 0.80).</para>
<para>It is much much slower to compute than convex hull but encloses the geometry better and is also useful for
<para>It is much slower to compute than convex hull but encloses the geometry better and is also useful for
image recognition.</para>
<para>Performed by the GEOS module</para>
......@@ -544,7 +546,7 @@ MULTILINESTRING((1 2,3 4),(3 4,4 5))
it may fail with invalid geometries.</para></note>
<note><para>Note - The smaller you make the target percent, the longer it takes to process the concave hull and more likely to run into topological exceptions. Also the more
floating points and number of points you acrue. First try a 0.99 which does a first hop and usually gives much better than 99% of shrink since it almost always overshoots. Second hope of 0.98 it slower, others get slower usually quadratically.
floating points and number of points you acrue. First try a 0.99 which does a first hop, is usually very fast, sometimes as fast as computing the convex hull, and usually gives much better than 99% of shrink since it almost always overshoots. Second hope of 0.98 it slower, others get slower usually quadratically.
To reduce precision and float points, use <xref linkend="ST_SimplifyPreserveTopology" /> or <xref linkend="ST_SnapToGrid" /> after ST_ConcaveHull. ST_SnapToGrid is a bit faster, but
could result in invalid geometries where as ST_SimplifyPreserveTopology almost always preserves the validity of the geometry.</para></note>
......@@ -552,7 +554,8 @@ MULTILINESTRING((1 2,3 4),(3 4,4 5))
url="http://www.bostongis.com/postgis_concavehull.snippet">http://www.bostongis.com/postgis_concavehull.snippet</ulink></para>
<para>Also check out Simon Greener's article on demonstrating ConcaveHull introduced in Oracle 11G R2. <ulink
url="http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/172/concave-hull-geometries-in-oracle-11gr2">http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/172/concave-hull-geometries-in-oracle-11gr2</ulink></para>
url="http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/172/concave-hull-geometries-in-oracle-11gr2">http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/172/concave-hull-geometries-in-oracle-11gr2</ulink>.
The solution we get at 0.75 target percent of convex hull is similar to the shape Simon gets with Oracle SDO_CONCAVEHULL_BOUNDARY.</para>
<para>Availability: 2.0.0</para>
</refsection>
......@@ -617,49 +620,21 @@ SELECT
<imageobject>
<imagedata fileref="images/st_concavehull04.png" />
</imageobject>
<caption><para>Set of points forming S overlaid with convex hull. This is a scaled/clipped version
adapted from <ulink url="http://www.spatialdbadvisor.com/oracle_spatial_tips_tricks/172/concave-hull-geometries-in-oracle-11gr2">Simon Greener's Oracle ConcaveHull example</ulink>
so we could fit on our document grid.</para></caption>
<caption><para>L Shape points overlaid with convex hull</para></caption>
</mediaobject>
</informalfigure>
<programlisting>
SELECT ST_GeomFromText(
'MULTIPOINT(0 60.75,4.5 44.25,9 138.75,9.75 33.75,9.75 127.5,12 61.5,
12 150,13.5 116.25,17.25 24.75,
18 45.75,19.5 159.75,21 107.25,21 138.75,24 62.25,25.5 33,26.25 17.25,
28.5 167.25,30 99.75,30 116.25,30 155.25,31.5 132,33 144,
34.5 51.75,36 63,36.75 12,38.25 173.25,39.75 93.75,40.5 24.75,
41.25 124.5,42 42.75,42.75 151.5,
47.25 7.5,47.25 111,48.75 64.5,49.5 177,51 90,51.75 35.25,52.5 53.25,
54 165,55.5 153.75,57 24.75,57.75 141,
58.5 3.75,58.5 109.5,60 44.25,60 129.75,60.75 180,62.25 86.25,66.75 148.5,67.5 16.5,
69 36.75,69 102,69 162,69.75 2.25,69.75 123.75,72 182.25,73.5 84,
78 152.25,80.25 33,81 0.75,
81 120,81 171,83.25 183.75,84.75 81.75,88.5 16.5,88.5 103.5,
89.25 153.75,91.5 30.75,92.25 0,92.25 117.75,94.5 183.75,95.25 172.5,
96 79.5,98.25 96,100.5 154.5,102.75 30,103.5 115.5,104.25 0,
105.75 183.75,107.25 77.25,108.75 13.5,111.75 153.75,
114 30.75,114 171,114.75 113.25,
115.5 98.25,116.25 0,116.25 86.25,117 183.75,
118.5 75,123 152.25,125.25 31.5,126 111.75,126.75 17.25,
127.5 0.75,128.25 183,129 84.75,129 99,129.75 72.75,
133.5 147.75,134.25 165,136.5 35.25,137.25 109.5,
138.75 2.25,139.5 180.75,141 69,141.75 139.5,
144 24,145.5 128.25,146.25 41.25,146.25 87.75,148.5 106.5,
150 4.5,150.75 62.25,150.75 75.75,150.75 178.5,
151.5 167.25,152.25 51,154.5 156,157.5 24,
158.25 129,158.25 144,159.75 88.5,159.75 103.5,
161.25 7.5,162 174.75,165.75 42,165.75 69.75,
166.5 155.25,168 30,168 54.75,170.25 99,
171 129.75,171.75 12,171.75 168.75,173.25 79.5,
179.25 145.5,180 61.5,180.75 94.5,181.5 162,
182.25 17.25,183.75 130.5,184.5 41.25,
186.75 72,189 153,189.75 87,190.5 25.5,192 60.75,
194.25 142.5,196.5 131.25,197.25 78,198 34.5)') As geom
INTO TABLE s_shape;
SELECT ST_ConvexHull(geom)
FROM s_shape;
-- this produces a table of 42 points that form an L shape
SELECT (ST_DumpPoints(ST_GeomFromText(
'MULTIPOINT(14 14,34 14,54 14,74 14,94 14,114 14,134 14,
150 14,154 14,154 6,134 6,114 6,94 6,74 6,54 6,34 6,
14 6,10 6,8 6,7 7,6 8,6 10,6 30,6 50,6 70,6 90,6 110,6 130,
6 150,6 170,6 190,6 194,14 194,14 174,14 154,14 134,14 114,
14 94,14 74,14 54,14 34,14 14)'))).geom
INTO TABLE l_shape;
SELECT ST_ConvexHull(ST_Collect(geom))
FROM l_shape;
</programlisting>
</para></entry>
<entry><para><informalfigure>
......@@ -667,12 +642,12 @@ FROM s_shape;
<imageobject>
<imagedata fileref="images/st_concavehull05.png" />
</imageobject>
<caption><para>ST_ConcaveHull of S points at target 99% of convex hull</para></caption>
<caption><para>ST_ConcaveHull of L points at target 99% of convex hull</para></caption>
</mediaobject>
</informalfigure>
<programlisting>
SELECT ST_ConcaveHull(geom, 0.99)
FROM s_shape;
SELECT ST_ConcaveHull(ST_Collect(geom), 0.99)
FROM l_shape;
</programlisting>
</para></entry>
</row>
......@@ -682,19 +657,14 @@ SELECT ST_ConcaveHull(geom, 0.99)
<imageobject>
<imagedata fileref="images/st_concavehull06.png" />
</imageobject>
<caption><para>Concave Hull of S points at target 75% convex hull area</para></caption>
<caption><para>Concave Hull of L points at target 80% convex hull area</para></caption>
</mediaobject>
</informalfigure>
<programlisting>
-- Concave Hull S shape points
-- at target 75% of convexhull
SELECT ST_ConcaveHull(geom, 0.75)
FROM s_shape;
-- to remove excess floating points
-- use ST_SimplifyPreserveTopology
SELECT ST_SimplifyPreserveTopology(ST_ConcaveHull(geom, 0.75),0.5)
FROM s_shape;
-- Concave Hull L shape points
-- at target 80% of convexhull
SELECT ST_ConcaveHull(ST_Collect(geom), 0.80)
FROM l_shape;
</programlisting>
</para>
</entry>
......@@ -703,13 +673,14 @@ SELECT ST_SimplifyPreserveTopology(ST_ConcaveHull(geom, 0.75),0.5)
<imageobject>
<imagedata fileref="images/st_concavehull07.png" />
</imageobject>
<caption><para>Concave hull of the S points with allowing holes</para></caption>
<caption><para>multilinestring with overlaid with Concave hull of linestrings at 99% target -- first hop</para></caption>
</mediaobject>
</informalfigure>
<programlisting>
-- Just the concave hull -- no overlaying of original geometries
SELECT ST_ConcaveHull(geom, 0.75,true)
FROM s_shape;
SELECT ST_ConcaveHull(ST_GeomFromText('MULTILINESTRING((106 164,30 112,74 70,82 112,130 94,130 62,122 40,156 32,162 76,172 88),
(132 178,134 148,128 136,96 128,132 108,150 130,170 142,174 110,156 96,158 90,158 88),
(22 64,66 28,94 38,94 68,114 76,112 30,132 10,168 18,178 34,186 52,184 74,190 100,
190 122,182 148,178 170,176 184,156 164,146 178,132 186,92 182,56 158,36 150,62 150,76 128,88 118))'),0.99)
</programlisting>
</para>
</entry>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment