From: Regina Obe Date: Tue, 4 Nov 2008 01:47:05 +0000 (+0000) Subject: Document ST_LineToCurve and ST_CurveToLine, update template to include note about... X-Git-Tag: 1.4.0b1~544 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4b9f8a0bb78b051038dde4329de387f5ef9c56d;p=postgis Document ST_LineToCurve and ST_CurveToLine, update template to include note about Circular String support in prep for new index section git-svn-id: http://svn.osgeo.org/postgis/trunk@3228 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_new.xml b/doc/reference_new.xml index b3b7c10f0..fb43bbdd5 100644 --- a/doc/reference_new.xml +++ b/doc/reference_new.xml @@ -8201,6 +8201,122 @@ SELECT ST_AsEWKT(ST_Collect(ST_GeomFromEWKT('POINT(1 2 3)'), + + + ST_CurveToLine + + Converts a CIRCULARSTRING to a LINESTRING + + + + + + geometry ST_CurveToLine + geometry geomCircularString + + + + + + Description + + Converst a CIRCULAR STRING to regular LINESTRING. Useful for outputting to devices that can't support CIRCULARSTRING geometry types + + Availability: 1.2.2? + + + + + + This method implements the OpenGIS Simple Features + Implementation Specification for SQL. + + + + + + + This method implements the SQL/MM specification: SQL-MM 3: 7.1.7 + + + + + + + This function supports 3d and will not drop the z-index. + + + + + + + This method supports Circular Strings and Curves + + + + + Examples + + SELECT ST_AsText(ST_CurveToLine(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227 150505,220227 150406)'))); + + --Result -- + LINESTRING(220268 150415,220269.95064912 150416.539364228,220271.823415575 150418.17258804,220273.613787707 150419.895736857, + 220275.317452352 150421.704659462,220276.930305234 150423.594998003,220278.448460847 150425.562198489, + 220279.868261823 150427.60152176,220281.186287736 150429.708054909,220282.399363347 150431.876723113, + 220283.50456625 150434.10230186,220284.499233914 150436.379429536,220285.380970099 150438.702620341,220286.147650624 150441.066277505, + 220286.797428488 150443.464706771,220287.328738321 150445.892130112,220287.740300149 150448.342699654, + 220288.031122486 150450.810511759,220288.200504713 150453.289621251,220288.248038775 150455.77405574, + 220288.173610157 150458.257830005,220287.977398166 150460.734960415,220287.659875492 150463.199479347, + 220287.221807076 150465.64544956,220286.664248262 150468.066978495,220285.988542259 150470.458232479,220285.196316903 150472.81345077, + 220284.289480732 150475.126959442,220283.270218395 150477.39318505,220282.140985384 150479.606668057, + 220280.90450212 150481.762075989,220279.5637474 150483.85421628,220278.12195122 150485.87804878, + 220276.582586992 150487.828697901,220274.949363179 150489.701464356,220273.226214362 150491.491836488, + 220271.417291757 150493.195501133,220269.526953216 150494.808354014,220267.559752731 150496.326509628, + 220265.520429459 150497.746310603,220263.41389631 150499.064336517,220261.245228106 150500.277412127, + 220259.019649359 150501.38261503,220256.742521683 150502.377282695,220254.419330878 150503.259018879, + 220252.055673714 150504.025699404,220249.657244448 150504.675477269,220247.229821107 150505.206787101, + 220244.779251566 150505.61834893,220242.311439461 150505.909171266,220239.832329968 150506.078553494, + 220237.347895479 150506.126087555,220234.864121215 150506.051658938,220232.386990804 150505.855446946, + 220229.922471872 150505.537924272,220227.47650166 150505.099855856,220225.054972724 150504.542297043, + 220222.663718741 150503.86659104,220220.308500449 150503.074365683, + 220217.994991777 150502.167529512,220215.72876617 150501.148267175, + 220213.515283163 150500.019034164,220211.35987523 150498.7825509, + 220209.267734939 150497.441796181,220207.243902439 150496, + 220205.293253319 150494.460635772,220203.420486864 150492.82741196,220201.630114732 150491.104263143, + 220199.926450087 150489.295340538,220198.313597205 150487.405001997,220196.795441592 150485.437801511, + 220195.375640616 150483.39847824,220194.057614703 150481.291945091,220192.844539092 150479.123276887,220191.739336189 150476.89769814, + 220190.744668525 150474.620570464,220189.86293234 150472.297379659,220189.096251815 150469.933722495, + 220188.446473951 150467.535293229,220187.915164118 150465.107869888,220187.50360229 150462.657300346, + 220187.212779953 150460.189488241,220187.043397726 150457.710378749,220186.995863664 150455.22594426, + 220187.070292282 150452.742169995,220187.266504273 150450.265039585,220187.584026947 150447.800520653, + 220188.022095363 150445.35455044,220188.579654177 150442.933021505,220189.25536018 150440.541767521, + 220190.047585536 150438.18654923,220190.954421707 150435.873040558,220191.973684044 150433.60681495, + 220193.102917055 150431.393331943,220194.339400319 150429.237924011,220195.680155039 150427.14578372,220197.12195122 150425.12195122, + 220198.661315447 150423.171302099,220200.29453926 150421.298535644,220202.017688077 150419.508163512,220203.826610682 150417.804498867, + 220205.716949223 150416.191645986,220207.684149708 150414.673490372,220209.72347298 150413.253689397,220211.830006129 150411.935663483, + 220213.998674333 150410.722587873,220216.22425308 150409.61738497,220218.501380756 150408.622717305,220220.824571561 150407.740981121, + 220223.188228725 150406.974300596,220225.586657991 150406.324522731,220227 150406) + + --3d example + SELECT ST_AsEWKT(ST_CurveToLine(ST_GeomFromEWKT('CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3)'))); + Output + ------ + LINESTRING(220268 150415 1,220269.95064912 150416.539364228 1.0181172856673, + 220271.823415575 150418.17258804 1.03623457133459,220273.613787707 150419.895736857 1.05435185700189,....AD INFINITUM .... + 220225.586657991 150406.324522731 1.32611114201132,220227 150406 3) + + + + + + + See Also + + + + + ST_Difference @@ -8413,6 +8529,195 @@ SELECT ST_AsEWKT(geom) As the_geom, path , , + + + + ST_Intersection + + Returns a geometry that represents the shared portion of geomA and geomB + + + + + + geometry ST_Intersection + + geometry + geomA + + + geometry + geomB + + + + + + Description + Returns a geometry that represents the point set + intersection of the Geometries. + + In other words - that portion of geometry A and geometry B + that is shared between the two geometries. + + If the geometries do not share any space (are disjoint), then an empty geometry collection + is returned. + ST_Intersection in conjunction with ST_Intersects is very useful for clipping geometries such as in bounding box, buffer, region + queries where you only want to return that portion of a geometry that sits in a country or region of interest. + + + Do not call with a GEOMETRYCOLLECTION as an argument + + + Performed by the GEOS module + + + + + This method implements the + OpenGIS Simple + Features Implementation Specification for SQL OGC SPEC s2.1.1.3 + + + + + + + + This method implements the SQL/MM specification: SQL-MM 3: 5.1.18 + + + Examples +SELECT ST_AsText(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry)); + st_astext +--------------- +GEOMETRYCOLLECTION EMPTY +(1 row) +SELECT ST_AsText(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry)); + st_astext +--------------- +POINT(0 0) +(1 row) + +---Clip all lines (trails) by country (here we assume country geom are POLYGON or MULTIPOLYGONS) +-- NOTE: we are only keeping intersections that result in a LINESTRING or MULTILINESTRING because we don't +-- care about trails that just share a point +-- the dump is needed to expand a geometry collection into individual single MULT* parts +-- the below is fairly generic and will work for polys, etc. by just changing the where clause +SELECT clipped.gid, clipped.f_name, clipped_geom +FROM (SELECT trails.gid, trails.f_name, (ST_Dump(ST_Intersection(country.the_geom, trails.the_geom))).geom As clipped_geom +FROM country + INNER JOIN trails + ON ST_Intersects(country.the_geom, trails.the_geom)) As clipped + WHERE ST_Dimension(clipped.clipped_geom) = 1 ; + +--For polys e.g. polygon landmarks, you can also use the sometimes faster hack that buffering anything by 0.0 +-- except a polygon results in an empty geometry collection +--(so a geometry collection containing polys, lines and points) +-- buffered by 0.0 would only leave the polygons and dissolve the collection shell +SELECT poly.gid, ST_Multi(ST_Buffer( + ST_Intersection(country.the_geom, poly.the_geom), + 0.0) + ) As clipped_geom +FROM country + INNER JOIN poly + ON ST_Intersects(country.the_geom, poly.the_geom) + WHERE Not ST_IsEmpty(ST_Buffer(ST_Intersection(country.the_geom, poly.the_geom),0.0)); + + + + See Also + , , , + + + + + + ST_LineToCurve + + Converts a LINESTRING/POLYGON to a CIRCULARSTRING, CURVED POLYGON + + + + + + geometry ST_LineToCurve + geometry geomANoncircular + + + + + + Description + + Converts plain LINESTRING/POLYGONS to CIRCULAR STRINGs and Curved Polygons. Note much fewer points are needed to describe the curved equivalent. + + Availability: 1.2.2? + + + + + + This method implements the OpenGIS Simple Features + Implementation Specification for SQL. + + + + + + + This method implements the SQL/MM specification: SQL-MM 3: 5.1.23 + + + + + + + This function supports 3d and will not drop the z-index. + + + + + + This method supports Circular Strings and Curves + + + + + Examples + + +SELECT ST_AsText(ST_LineToCurve(foo.the_geom)) As curvedastext,ST_AsText(foo.the_geom) As non_curvedastext + FROM (SELECT ST_Buffer('POINT(1 3)'::geometry, 3) As the_geom) As foo; + +curvedatext non_curvedastext +------------------------------------------------------------------| ----------------------------------------------------------------- +CURVEPOLYGON(CIRCULARSTRING(4 3,3.12132034355964 0.878679656440359, | POLYGON((4 3,3.94235584120969 2.41472903395162,3.77163859753386 1.85194970290473 +1 0,-1.12132034355965 5.12132034355963,4 3)) | ,3.49440883690764 1.33328930094119,3.12132034355964 0.878679656440359, + | 2.66671069905881 0.505591163092366,2.14805029709527 0.228361402466141, + | 1.58527096604839 0.0576441587903094,1 0, + | 0.414729033951621 0.0576441587903077,-0.148050297095264 0.228361402466137, + | -0.666710699058802 0.505591163092361,-1.12132034355964 0.878679656440353, + | -1.49440883690763 1.33328930094119,-1.77163859753386 1.85194970290472 + | --ETC-- ,3.94235584120969 3.58527096604839,4 3)) +--3D example +SELECT ST_AsEWKT(ST_LineToCurve(ST_GeomFromEWKT('LINESTRING(1 2 3, 3 4 8, 5 6 4, 7 8 4, 9 10 4)'))); + + st_asewkt +------------------------------------ + CIRCULARSTRING(1 2 3,5 6 4,9 10 4) + + + + + + + See Also + + + + @@ -8520,107 +8825,6 @@ FROM , , , , - - - - ST_Intersection - - Returns a geometry that represents the shared portion of geomA and geomB - - - - - - geometry ST_Intersection - - geometry - geomA - - - geometry - geomB - - - - - - Description - Returns a geometry that represents the point set - intersection of the Geometries. - - In other words - that portion of geometry A and geometry B - that is shared between the two geometries. - - If the geometries do not share any space (are disjoint), then an empty geometry collection - is returned. - ST_Intersection in conjunction with ST_Intersects is very useful for clipping geometries such as in bounding box, buffer, region - queries where you only want to return that portion of a geometry that sits in a country or region of interest. - - - Do not call with a GEOMETRYCOLLECTION as an argument - - - Performed by the GEOS module - - - - - This method implements the - OpenGIS Simple - Features Implementation Specification for SQL OGC SPEC s2.1.1.3 - - - - - - - - This method implements the SQL/MM specification: SQL-MM 3: 5.1.18 - - - Examples -SELECT ST_AsText(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry)); - st_astext ---------------- -GEOMETRYCOLLECTION EMPTY -(1 row) -SELECT ST_AsText(ST_Intersection('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry)); - st_astext ---------------- -POINT(0 0) -(1 row) - ----Clip all lines (trails) by country (here we assume country geom are POLYGON or MULTIPOLYGONS) --- NOTE: we are only keeping intersections that result in a LINESTRING or MULTILINESTRING because we don't --- care about trails that just share a point --- the dump is needed to expand a geometry collection into individual single MULT* parts --- the below is fairly generic and will work for polys, etc. by just changing the where clause -SELECT clipped.gid, clipped.f_name, clipped_geom -FROM (SELECT trails.gid, trails.f_name, (ST_Dump(ST_Intersection(country.the_geom, trails.the_geom))).geom As clipped_geom -FROM country - INNER JOIN trails - ON ST_Intersects(country.the_geom, trails.the_geom)) As clipped - WHERE ST_Dimension(clipped.clipped_geom) = 1 ; - ---For polys e.g. polygon landmarks, you can also use the sometimes faster hack that buffering anything by 0.0 --- except a polygon results in an empty geometry collection ---(so a geometry collection containing polys, lines and points) --- buffered by 0.0 would only leave the polygons and dissolve the collection shell -SELECT poly.gid, ST_Multi(ST_Buffer( - ST_Intersection(country.the_geom, poly.the_geom), - 0.0) - ) As clipped_geom -FROM country - INNER JOIN poly - ON ST_Intersects(country.the_geom, poly.the_geom) - WHERE Not ST_IsEmpty(ST_Buffer(ST_Intersection(country.the_geom, poly.the_geom),0.0)); - - - - See Also - , , , - - diff --git a/doc/template.xml b/doc/template.xml index 4390c66ab..d0348eed2 100644 --- a/doc/template.xml +++ b/doc/template.xml @@ -35,6 +35,8 @@ comparison that will make use of any indexes that are available on the geometries. + + Availability: version goes here - requires GEOS >= 2.1.0. @@ -58,6 +60,13 @@ This function supports 3d and will not drop the z-index. + + + + + + + This method supports Circular Strings and Curves