From: Regina Obe Date: Wed, 23 Jul 2008 12:03:03 +0000 (+0000) Subject: move of ST_AsBinary,ST_AsEWKB - add examples, various minor fixes to ST_As function... X-Git-Tag: 1.4.0b1~822 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=16d6ae7cc87cd9aae9d6c3fa00c6949bfc33c0aa;p=postgis move of ST_AsBinary,ST_AsEWKB - add examples, various minor fixes to ST_As function descriptions git-svn-id: http://svn.osgeo.org/postgis/trunk@2878 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference.xml b/doc/reference.xml index 18ad920f9..a14755022 100644 --- a/doc/reference.xml +++ b/doc/reference.xml @@ -380,22 +380,6 @@ Geometry Accessors - - - ST_AsBinary(geometry) - - - Returns the geometry in the OGC "well-known-binary" format, - using the endian encoding of the server on which the database is - running. This is useful in binary cursors to pull data out of the - database without converting it to a string representation. - - OGC SPEC s2.1.1.1 - also see - asBinary(<geometry>,'XDR') and - asBinary(<geometry>,'NDR') - - - ST_SRID(geometry) @@ -1377,17 +1361,6 @@ GROUP BY gid, field1,field2; Geometry Outputs - - ST_AsBinary(geometry,{'NDR'|'XDR'}) - - - Returns the geometry in the OGC "well-known-binary" format - as a bytea, using little-endian (NDR) or big-endian (XDR) - encoding. This is useful in binary cursors to pull data out of the - database without converting it to a string representation. - - - ST_AsHEXEWKB(geometry, {'NDR'|'XDR'}) @@ -2339,17 +2312,6 @@ WHERE n*100.00/length < 1; - - ST_AsBinary - - - Return the well-known binary representation of an ST_Geometry - value. - - SQL-MM 3: 5.1.37 - - - ST_Boundary diff --git a/doc/reference_new.xml b/doc/reference_new.xml index 5ed334629..243867420 100644 --- a/doc/reference_new.xml +++ b/doc/reference_new.xml @@ -1225,6 +1225,165 @@ CREATE INDEX idx_the_geom_26986_parcels Geometry Outputs + + + ST_AsBinary + Return the Well-Known Binary (WKB) representation of the geometry without SRID meta data. + + + + + + bytea ST_AsBinary + geometry g1 + + + bytea ST_AsBinary + geometry g1 + text NDR_or_XDR + + + + + + Description + + Returns the Well-Known Binary representation of the geometry. There are 2 variants of the function. The first + variant takes no endian encoding paramater and defaults to little endian. The second variant takes a second argument + denoting the encoding - using little-endian ('NDR') or big-endian ('XDR') encoding. + This is useful in binary cursors to pull data out of the + database without converting it to a string representation. + + + The WKB spec does not include the SRID. To get the OGC WKB with SRID format use ST_AsEWKB + + + ST_AsBinary is the reverse of ST_GeomFromWKB. Use ST_GeomFromWKB to convert to a postgis geometry from ST_AsBinary representation. + + + + + + + This method implements the OpenGIS Simple Features + Implementation Specification for SQL. OGC SPEC s2.1.1.1 + + + + + + This method implements the SQL/MM specification: SQL-MM 3: 5.1.37 + + + + + + + Examples + + SELECT ST_AsBinary(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326)); + + st_asbinary +-------------------------------- +\001\003\000\000\000\001\000\000\000\005 +\000\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000 +\000\000\000\360?\000\000\000\000\000\000 +\360?\000\000\000\000\000\000\360?\000\000 +\000\000\000\000\360?\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000 +(1 row) + SELECT ST_AsBinary(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326), 'XDR'); + st_asbinary +-------------------------------- +\000\000\000\000\003\000\000\000\001\000\000\000\005\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 +\000?\360\000\000\000\000\000\000?\360\000\000\000\000\000\000?\360\000\000 +\000\000\000\000?\360\000\000\000\000\000\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 +(1 row) + + + + + See Also + , , , + + + + + ST_AsEWKB + Return the Well-Known Binary (WKB) representation of the geometry with SRID meta data. + + + + + + bytea ST_AsEWKB + geometry g1 + + + bytea ST_AsEWKB + geometry g1 + text NDR_or_XDR + + + + + + Description + Returns the Well-Known Binary representation of the geometry with SRID metadata. There are 2 variants of the function. The first + variant takes no endian encoding paramater and defaults to little endian. The second variant takes a second argument + denoting the encoding - using little-endian ('NDR') or big-endian ('XDR') encoding. + This is useful in binary cursors to pull data out of the + database without converting it to a string representation. + + The WKB spec does not include the SRID. To get the OGC WKB format use ST_AsBinary + + + ST_AsEWKB is the reverse of ST_GeomFromEWKB. Use ST_GeomFromEWKB to convert to a postgis geometry from ST_AsEWKB representation. + + + + + + Examples + + SELECT ST_AsEWKB(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326)); + + st_asewkb +-------------------------------- +\001\003\000\000 \346\020\000\000\001\000 +\000\000\005\000\000\000\000 +\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000 +\000\000\360?\000\000\000\000\000\000\360? +\000\000\000\000\000\000\360?\000\000\000\000\000 +\000\360?\000\000\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000\000\000\000 +(1 row) + + SELECT ST_AsEWKB(ST_GeomFromText('POLYGON((0 0,0 1,1 1,1 0,0 0))',4326), 'XDR'); + st_asewkb +-------------------------------- +\000 \000\000\003\000\000\020\346\000\000\000\001\000\000\000\005\000\000\000\000\ +000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000? +\360\000\000\000\000\000\000?\360\000\000\000\000\000\000?\360\000\000\000\000 +\000\000?\360\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000 +\000\000\000\000\000\000\000\000\000\000\000\000\000 + + + + + + See Also + , , , , + + ST_AsEWKT @@ -1248,6 +1407,9 @@ CREATE INDEX idx_the_geom_26986_parcels The WKT spec does not include the SRID. To get the OGC WKT format use ST_AsText + + WKT format does not maintain precision so to prevent floating truncation, use ST_AsBinary or ST_AsEWKB format for transport. + ST_AsEWKT is the reverse of ST_GeomFromEWKT. Use ST_GeomFromEWKT to convert to a postgis geometry from ST_AsEWKT representation. @@ -1257,10 +1419,10 @@ CREATE INDEX idx_the_geom_26986_parcels Examples - SELECT ST_AsEWKT(ST_SetSRID('01030000000100000005000000000000000000 -000000000000000000000000000000000000000000000000 -F03F000000000000F03F000000000000F03F000000000000F03 -F000000000000000000000000000000000000000000000000', 4326)); + SELECT ST_AsEWKT('0103000020E61000000100000005000000000000 + 000000000000000000000000000000000000000000000000000000 + F03F000000000000F03F000000000000F03F000000000000F03 + F000000000000000000000000000000000000000000000000'::geometry); st_asewkt -------------------------------- @@ -1271,14 +1433,13 @@ SRID=4326;POLYGON((0 0,0 1,1 1,1 0,0 0)) See Also - - , + , ST_AsText - Return the Well-Known Text (WKT) representation of the geometry. + Return the Well-Known Text (WKT) representation of the geometry without SRID metadata. @@ -1299,6 +1460,9 @@ SRID=4326;POLYGON((0 0,0 1,1 1,1 0,0 0)) The WKT spec does not include the SRID. To get the SRID as part of the data, use the non-standard PostGIS ST_AsEWKT() + + WKT format does not maintain precision so to prevent floating truncation, use ST_AsBinary or ST_AsEWKB format for transport. + ST_AsText is the reverse of ST_GeomFromText. Use ST_GeomFromText to convert to a postgis geometry from ST_AsText representation. @@ -1339,7 +1503,7 @@ F000000000000000000000000000000000000000000000000'); See Also - , + , , ,