# This test tests the GIS functions that take as arguments a BLOB containing # a Well-Known Binary (WKB) representation and optionally, a spatial reference # system identifier (SRID). They return the corresponding geometry. # # Creation Date : 2016-03-16 # Author : Pavan Naik # ################################################################################## # # ################################################################################## SET @wkb_pt = ST_AsWKB(ST_GeomFromText('POINT(0 1)')); SET @wkb_ln = ST_AsWKB(ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)')); SET @wkb_py = ST_AsWKB(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))')); SET @wkb_mpt = ST_AsWKB(ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)')); SET @wkb_mln = ST_AsWKB(ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))')); SET @wkb_mpy = ST_AsWKB(ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),' '((10 11,10 12,12 13,12 10,10 11)))')); SET @wkb_gc = ST_AsWKB(ST_GeomFromText('GEOMETRYCOLLECTION(' 'POINT(0 1),' 'LINESTRING(0 1,10 11),' 'POLYGON((0 0,0 10,10 10,10 0, 0 0)),' 'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),' 'MULTILINESTRING((0 1,10 11),(0 10,10 0)),' 'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))')); --echo # --echo # Functions that accept a WKT value of any geometry type. --echo # --echo # ST_GeomFromWKB() SELECT ST_AsText(ST_GeomFromWKB(@wkb_pt)); SELECT ST_AsText(ST_GeomFromWKB(@wkb_ln)); SELECT ST_AsText(ST_GeomFromWKB(@wkb_py)); SELECT ST_AsText(ST_GeomFromWKB(@wkb_mpt)); SELECT ST_AsText(ST_GeomFromWKB(@wkb_mln)); SELECT ST_AsText(ST_GeomFromWKB(@wkb_mpy)); SELECT ST_AsText(ST_GeomFromWKB(@wkb_gc)); --echo # ST_GeometryFromWKB() SELECT ST_AsText(ST_GeometryFromWKB(@wkb_pt)); SELECT ST_AsText(ST_GeometryFromWKB(@wkb_ln)); SELECT ST_AsText(ST_GeometryFromWKB(@wkb_py)); SELECT ST_AsText(ST_GeometryFromWKB(@wkb_mpt)); SELECT ST_AsText(ST_GeometryFromWKB(@wkb_mln)); SELECT ST_AsText(ST_GeometryFromWKB(@wkb_mpy)); SELECT ST_AsText(ST_GeometryFromWKB(@wkb_gc)); --echo # --echo # Function that accepts a WKT value of Point geometry --echo # --echo # ST_PointFromWKB() SELECT ST_AsText(ST_PointFromWKB(@wkb_pt)); --echo # --echo # Functions that accept a WKT value of LineString geometry --echo # --echo # ST_LineFromWKB() SELECT ST_AsText(ST_LineFromWKB(@wkb_ln)); --echo # ST_LineStringFromWKB() SELECT ST_AsText(ST_LineStringFromWKB(@wkb_ln)); --echo # --echo # Functions that accept a WKT value of Polygon geometry --echo # --echo # ST_PolyFromWKB() SELECT ST_AsText(ST_PolyFromWKB(@wkb_py)); --echo # ST_PolygonFromWKB() SELECT ST_AsText(ST_PolygonFromWKB(@wkb_py)); --echo # --echo # Functions that accept a WKT value of MultiPoint geometry --echo # --echo # ST_MPointFromWKB() SELECT ST_AsText(ST_MPointFromWKB(@wkb_mpt)); --echo # ST_MultiPointFromWKB() SELECT ST_AsText(ST_MultiPointFromWKB(@wkb_mpt)); --echo # --echo # Functions that accept a WKT value of MultiLineString geometry --echo # --echo # ST_MLineFromWKB() SELECT ST_AsText(ST_MLineFromWKB(@wkb_mln)); --echo # ST_MultiLineStringFromWKB() SELECT ST_AsText(ST_MultiLineStringFromWKB(@wkb_mln)); --echo # --echo # Functions that accept a WKT value of MultiPolygon geometry --echo # --echo # ST_MPolyFromWKB() SELECT ST_AsText(ST_MPolyFromWKB(@wkb_mpy)); --echo # ST_MultiPolygonFromWKB() SELECT ST_AsText(ST_MultiPolygonFromWKB(@wkb_mpy)); --echo # --echo # Functions that accept a WKT value of GeometryCollection geometry --echo # --echo # ST_GeomCollFromWKB() SELECT ST_AsText(ST_GeomCollFromWKB(@wkb_gc)); --echo # ST_GeometryCollectionFromWKB() SELECT ST_AsText(ST_GeometryCollectionFromWKB(@wkb_gc)); --echo # --echo # Invalid function calls --echo # --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_GeomFromWKB(); SELECT ST_GeomFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_GeomFromWKB(ST_GeomFromText('POINT()')); --error ER_GIS_INVALID_DATA SELECT ST_GeomFromWKB(ST_GeomFromText('LINESTRING(0 0,! 10)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_GeometryFromWKB(); SELECT ST_GeometryFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_GeometryFromWKB(ST_GeomFromText('POINT(! 0)')); --error ER_GIS_INVALID_DATA SELECT ST_GeometryFromWKB(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_PointFromWKB(); SELECT ST_PointFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_PointFromWKB(ST_GeomFromText('POINT()')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_LineFromWKB(); SELECT ST_LineFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_LineFromWKB(ST_GeomFromText('LINESTRING(a a,b b)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_LineStringFromWKB(); SELECT ST_LineStringFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_LineStringFromWKB(ST_GeomFromText('LINESTRING(1 1,1 b)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_PolyFromWKB(); SELECT ST_PolyFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_PolyFromWKB(ST_GeomFromText('POLYGON(())')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_PolygonFromWKB(); SELECT ST_PolygonFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_PolygonFromWKB(ST_GeomFromText('POLYGON((0 0,0 5,5 5,5 0,0 0),())')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_MPointFromWKB(); SELECT ST_MPointFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_MPointFromWKB(ST_GeomFromText('MULTIPOINT(0 0,1)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_MultiPointFromWKB(); SELECT ST_MultiPointFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_MultiPointFromWKB(ST_GeomFromText('MULTIPOINT(0 0,1 1 1)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_MLineFromWKB(); SELECT ST_MLineFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_MLineFromWKB(ST_GeomFromText('MULTILINESTRING((0 0,1),())')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_MultiLineStringFromWKB(); SELECT ST_MultiLineStringFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_MultiLineStringFromWKB(ST_GeomFromText('MULTILINESTRING((0 0,1),(1 1,2 2)')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_MPolyFromWKB(); SELECT ST_MPolyFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_MPolyFromWKB(ST_GeomFromText('MULTIPOLYGON(((0 0,1)),(()))')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_MultiPolygonFromWKB(); SELECT ST_MultiPolygonFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_MultiPolygonFromWKB(ST_GeomFromText('MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)),(2 2,2 3,3 3,3 2,2 2))')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_GeomCollFromWKB(); SELECT ST_GeomCollFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_GeomCollFromWKB(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(a a))')); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT SELECT ST_GeometryCollectionFromWKB(); SELECT ST_GeometryCollectionFromWKB(NULL); --error ER_GIS_INVALID_DATA SELECT ST_GeometryCollectionFromWKB(ST_GeomFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,1 1)')); --echo # --echo # WL#8579 Spatial Reference Systems --echo # DELIMITER |; CREATE PROCEDURE gis_wkb_funcs(IN srid INT) BEGIN SET @wkb_pt = ST_AsWKB(ST_GeomFromText('POINT(0 1)')); SET @wkb_ln = ST_AsWKB(ST_GeomFromText('LINESTRING(0 1,2 3,4 5,6 7,8 9, 10 11)')); SET @wkb_py = ST_AsWKB(ST_GeomFromText('POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,4 6,6 6,6 4,4 4))')); SET @wkb_mpt = ST_AsWKB(ST_GeomFromText('MULTIPOINT(0 1,2 3,4 5,6 7)')); SET @wkb_mln = ST_AsWKB(ST_GeomFromText('MULTILINESTRING((0 1,2 3,4 5),(6 7,8 9,10 11))')); SET @wkb_mpy = ST_AsWKB(ST_GeomFromText('MULTIPOLYGON(((0 1,0 10,10 11,10 0,0 1),(4 5,4 6,6 7,6 4,4 5)),' '((10 11,10 12,12 13,12 10,10 11)))')); SET @wkb_gc = ST_AsWKB(ST_GeomFromText('GEOMETRYCOLLECTION(' 'POINT(0 1),' 'LINESTRING(0 1,10 11),' 'POLYGON((0 0,0 10,10 10,10 0, 0 0)),' 'MULTIPOINT(0 1,2 3,4 5,6 7,8 9,10 11),' 'MULTILINESTRING((0 1,10 11),(0 10,10 0)),' 'MULTIPOLYGON(((0 1,0 5,5 6,5 0,0 1)),((5 4,5 10,10 11,10 5,5 4))))')); # GIS WKB functions DO ST_GeomFromWKB(@wkb_pt, srid); DO ST_GeometryFromWKB(@wkb_pt, srid); DO ST_PointFromWKB(@wkb_pt, srid); DO ST_LineFromWKB(@wkb_ln, srid); DO ST_LineStringFromWKB(@wkb_ln, srid); DO ST_PolyFromWKB(@wkb_py, srid); DO ST_PolygonFromWKB(@wkb_py, srid); DO ST_MPointFromWKB(@wkb_mpt, srid); DO ST_MultiPointFromWKB(@wkb_mpt, srid); DO ST_MLineFromWKB(@wkb_mln, srid); DO ST_MultiLineStringFromWKB(@wkb_mln, srid); DO ST_MPolyFromWKB(@wkb_mpy, srid); DO ST_MultiPolygonFromWKB(@wkb_mpy, srid); DO ST_GeomCollFromWKB(@wkb_gc, srid); DO ST_GeometryCollectionFromWKB(@wkb_gc, srid); END | DELIMITER ;| --echo # SRID 0 (should pass) CALL gis_wkb_funcs(0); --echo # Projected SRS (should pass) CALL gis_wkb_funcs(2000); --echo # Geographic SRS (should pass) CALL gis_wkb_funcs(4326); --echo # Undefined SRS (should pass) # Assume SRID 19000000 is undefined --error ER_SRS_NOT_FOUND CALL gis_wkb_funcs(19000000); --echo ######################################################################## --echo # WL 9435 Axis order in WKB parsing functions --echo # ST_GeomFromWKB --echo # ST_GeometryFromWKB --echo # ST_PointFromWKB --echo # ST_LineFromWKB --echo # ST_LineStringFromWKB --echo # ST_PolyFromWKB --echo # ST_PolygonFromWKB --echo # ST_GeomCollFromWKB --echo # ST_GeometryCollectionFromWKB --echo # ST_MPointFromWKB --echo # ST_MultiPointFromWKB --echo # ST_MLineFromWKB --echo # ST_MultiLineStringFromWKB --echo # ST_MPolyFromWKB --echo # ST_MultiPolygonFromWKB --echo ######################################################################## --echo ######################################################################## --echo # Inserting testing SRS values in spatial reference table --echo ######################################################################## --echo # Inserting geographical srs with long-lat ordering CREATE SPATIAL REFERENCE SYSTEM 31000000 NAME 'TEST31000000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LONG",EAST],AXIS["LAT",NORTH],AUTHORITY["EPSG","31000000"]]'; --echo # Inserting geographical srs with lat-long ordering CREATE SPATIAL REFERENCE SYSTEM 31100000 NAME 'TEST31100000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LAT",NORTH],AXIS["LONG",EAST],AUTHORITY["EPSG","31100000"]]'; --echo # Inserting projected srs with northing-easting ordering CREATE SPATIAL REFERENCE SYSTEM 31200000 NAME 'TEST31200000' DEFINITION 'PROJCS["NAD83(NSRS2007) / Virginia Lambert",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83 (National Spatial Reference System 2007)",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4759"]],PROJECTION["Lambert Conic Conformal (2SP)",AUTHORITY["EPSG","9802"]],PARAMETER["Latitude of false origin",36,AUTHORITY["EPSG","8821"]],PARAMETER["Longitude of false origin",-79.5,AUTHORITY["EPSG","8822"]],PARAMETER["Latitude of 1st standard parallel",37,AUTHORITY["EPSG","8823"]],PARAMETER["Latitude of 2nd standard parallel",39.5,AUTHORITY["EPSG","8824"]],PARAMETER["Easting at false origin",0,AUTHORITY["EPSG","8826"]],PARAMETER["Northing at false origin",0,AUTHORITY["EPSG","8827"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",NORTH],AXIS["Y",EAST],AUTHORITY["EPSG","31200000"]]'; --echo # Inserting projected srs with easting-northing ordering CREATE SPATIAL REFERENCE SYSTEM 31300000 NAME 'TEST31300000' DEFINITION 'PROJCS["NAD83(NSRS2007) / Virginia Lambert",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83 (National Spatial Reference System 2007)",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4759"]],PROJECTION["Lambert Conic Conformal (2SP)",AUTHORITY["EPSG","9802"]],PARAMETER["Latitude of false origin",36,AUTHORITY["EPSG","8821"]],PARAMETER["Longitude of false origin",-79.5,AUTHORITY["EPSG","8822"]],PARAMETER["Latitude of 1st standard parallel",37,AUTHORITY["EPSG","8823"]],PARAMETER["Latitude of 2nd standard parallel",39.5,AUTHORITY["EPSG","8824"]],PARAMETER["Easting at false origin",0,AUTHORITY["EPSG","8826"]],PARAMETER["Northing at false origin",0,AUTHORITY["EPSG","8827"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","31300000"]]'; --echo # When the geometry is in a projected spatial reference system, --echo # the coordinates are interpreted as in the order they appear in the geometry. --echo ######################################################################## --echo # Retrieving geometrycollections with the ST_GEOMFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_GEOMFROMWKB(ST_ASWKB(GEOMETRYCOLLECTION(POINT(3, 5))), 31000000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving points with the ST_GEOMETRYFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_pt, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_mpt, 31100000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_GEOMETRYFROMWKB(@wkb_mpt, 31200000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving points with the ST_POINTFROMWKB function --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)), 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)), 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)),31000000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_POINTFROMWKB(St_AsWKB(point(1, 2)),31300000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving linestrings with the ST_LineFromWKB function --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31100000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_LINEFROMWKB(@wkb_ln, 31000000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving linestrings with the ST_LineStringFromWKB function --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31100000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_LINESTRINGFROMWKB(@wkb_ln, 31000000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving polygons with the ST_POLYFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31000000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_POLYFROMWKB(@wkb_py, 31300000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving polygons with the ST_POLYGONFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31000000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_POLYGONFROMWKB(@wkb_py, 31300000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving geometrycollections with the ST_GEOMCOLLFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31300000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving geometrycollections with the ST_GEOMETRYCOLLECTIONFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, 31000000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, 31000000,'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_GEOMETRYCOLLECTIONFROMWKB(@wkb_gc, 31300000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving multipoints with the ST_MPOINTFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31000000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31000000,'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31300000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving multipoints with the ST_MULTIPOINTFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, 31000000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, 31000000,'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_MULTIPOINTFROMWKB(@wkb_mpt, 31300000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving multistrings with the ST_MLINEFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31000000,'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_MLINEFROMWKB(@wkb_mln, 31300000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving multistrings with the ST_MULTILINESTRINGFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, 31000000,'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, 31000000,'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, 31000000,'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_MULTILINESTRINGFROMWKB(@wkb_mln, 31300000,'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving multipolygons with the ST_MPOLYFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31300000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Retrieving multipolygons with the ST_MULTIPOLYGONFROMWKB function --echo # --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=long-lat')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=lat-long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'axis-order=srid-defined')); SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31300000, 'axis-order=srid-defined')); --echo ######################################################################## --echo # Error testing --echo ######################################################################## --echo # Test with too many options. --error ER_DUPLICATE_OPTION_KEY SELECT ST_ASTEXT(ST_MPOLYFROMWKB(@wkb_mpy, 31000000, 'axis-order=srid-defined, axis-order=lat-long')); --echo # Test with invalid options key. --error ER_INVALID_OPTION_KEY SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axix-order=srid-defined')); --error ER_INVALID_OPTION_KEY SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axix-order=lat-long')); --error ER_INVALID_OPTION_KEY SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axix-order=lat-long')); --echo # Test with invalid options value --error ER_INVALID_OPTION_VALUE SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31300000,'axis-order=srid-dfined')); --error ER_INVALID_OPTION_VALUE SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=lat-bong')); --error ER_INVALID_OPTION_VALUE SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=lat-shwong')); --echo # Test with both invalid option and invalid value --error ER_INVALID_OPTION_KEY SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-border=lat-shwong')); --echo # Testing for badly formed options argument. --error ER_INVALID_OPTION_KEY_VALUE_PAIR SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order srid-defined')); --error ER_INVALID_OPTION_START_CHARACTER SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'=axis-order srid-defined')); --error ER_INVALID_OPTION_END_CHARACTER SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order=srid-defined=')); --error ER_INVALID_OPTION_CHARACTERS SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'axis-order== srid-defined')); --echo # ###################################################################### --echo # Empty string and white space testing --echo # ###################################################################### SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,'')); SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,' ')); SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(@wkb_gc, 31000000,' axis-order = srid-defined ')); --echo ######################################################################## --echo # Case insensitive testing in otions argument --echo # (both option keys and values) --echo ######################################################################## --echo # Retrieve values with long lat ordering. SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'aXis-Order=LONG-LAT')); --echo # Retrieve values with lat-long ordering. SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'AXis-OrdEr=Lat-Long')); --echo # Retrieve values with SRID-defined ordering. SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31000000, 'Axis-Order=sRid-dEfined')); SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 31300000, 'aXiS-oRdeR=sriD-dEfinEd')); --echo # ###################################################################### --echo # NULL value and 0 value srid testing --echo # ###################################################################### --echo # NULL value testing: Should return NULL if either or both parameters is NULL SELECT ST_ASTEXT(ST_POINTFROMWKB(NULL,31000000, 'axis-order=long-lat')); SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, NULL, 'axis-order=lat-long')); SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, 31000000, NULL)); SELECT ST_ASTEXT(ST_MPOINTFROMWKB(@wkb_mpt, NULL, NULL)); SELECT ST_ASTEXT(ST_MPOINTFROMWKB(NULL, NULL, NULL)); --echo # Coordinates are interpreted as in the order they appear in the geometry SELECT ST_ASTEXT(ST_MULTIPOLYGONFROMWKB(@wkb_mpy, 0, 'axis-order=srid-defined')); ###################################################################### # WL#9449 Restrict range of geographic coordinates in import functions ###################################################################### --echo ########################################################## --echo # Inserting testing SRS values in spatial reference table --echo ########################################################## --echo # Inserting geographical srs with long-lat ordering CREATE SPATIAL REFERENCE SYSTEM 32000000 NAME 'TEST32000000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LONG",EAST],AXIS["LAT",NORTH],AUTHORITY["EPSG","32000000"]]'; --echo # Inserting geographical srs with lat-long ordering CREATE SPATIAL REFERENCE SYSTEM 32100000 NAME 'TEST32100000' DEFINITION 'GEOGCS["SIRGAS 1995",DATUM["Sistema de Referencia Geocentrico para America del Sur 1995",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6170"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["LAT",NORTH],AXIS["LONG",EAST],AUTHORITY["EPSG","32100000"]]'; --echo # Inserting projected srs with northing-easting ordering CREATE SPATIAL REFERENCE SYSTEM 32200000 NAME 'TEST32200000' DEFINITION 'PROJCS["NAD83(NSRS2007) / Virginia Lambert",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83 (National Spatial Reference System 2007)",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4759"]],PROJECTION["Lambert Conic Conformal (2SP)",AUTHORITY["EPSG","9802"]],PARAMETER["Latitude of false origin",36,AUTHORITY["EPSG","8821"]],PARAMETER["Longitude of false origin",-79.5,AUTHORITY["EPSG","8822"]],PARAMETER["Latitude of 1st standard parallel",37,AUTHORITY["EPSG","8823"]],PARAMETER["Latitude of 2nd standard parallel",39.5,AUTHORITY["EPSG","8824"]],PARAMETER["Easting at false origin",0,AUTHORITY["EPSG","8826"]],PARAMETER["Northing at false origin",0,AUTHORITY["EPSG","8827"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",NORTH],AXIS["Y",EAST],AUTHORITY["EPSG","32200000"]]'; --echo ######################################################################### --echo # Test with geometries with geographic SRS with long-lat ordering outside --echo # valid range. --echo ######################################################################### --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)', 0)), 32000000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)', 0)), 32000000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)), 32000000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (-344 9))',0)),32000000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32000000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32000000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32000000); --echo ######################################################################### --echo # Test with geometries with geographic SRS with lat-long ordering outside --echo # valid range (same geometries as above, but with different error since --echo # coordinates are flipped). --echo ######################################################################### --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32100000); --echo ############################## --echo # Miscellaneous error testing --echo ############################## --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-91 10)',0)),32100000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -182)',0)),32100000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 91,14 17))',0)),32000000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 95,2 4,4 6),(744 11,11 91,14 17))',0)),32000000); --echo ################### --echo # Edge case testing --echo ################### SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-90.0000000 10)',0)),32100000)); SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -180.0000000)',0)),32100000)); SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(90.0000000 10)',0)),32100000)); SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 180.0000000)',0)),32100000)); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-90.0000001 10)',0)),32100000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 -180.0000001)',0)),32100000); --error ER_LATITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(90.0000001 10)',0)),32100000); --error ER_LONGITUDE_OUT_OF_RANGE SELECT ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(10 180.0000001)',0)),32100000); --echo ################################################################# --echo # Test that range restriction does not apply to projected spatial --echo # reference systems --echo ################################################################# SELECT ST_ASTEXT(ST_POINTFROMWKB(ST_ASWKB(ST_POINTFROMTEXT('POINT(-200 10)',0)),32200000)); SELECT ST_ASTEXT(ST_LINEFROMWKB(ST_ASWKB(ST_LINEFROMTEXT('LINESTRING(0 5,194 10,10 15)',0)),32200000)); SELECT ST_ASTEXT(ST_POLYFROMWKB(ST_ASWKB(ST_POLYFROMTEXT('POLYGON((0 0,5 0,5 5,-300 5,0 0))',0)),32200000)); SELECT ST_ASTEXT(ST_MPOINTFROMWKB(ST_ASWKB(ST_MPOINTFROMTEXT('MULTIPOINT((0 2), (5 7), (798 2), (4 9))',0)),32200000)); SELECT ST_ASTEXT(ST_MLINEFROMWKB(ST_ASWKB(ST_MLINEFROMTEXT('MULTILINESTRING((0 2,2 4,4 6),(744 11,11 14,14 17))',0)),32200000)); SELECT ST_ASTEXT(ST_MPOLYFROMWKB(ST_ASWKB(ST_MPOLYFROMTEXT('MULTIPOLYGON(((0 0,350 0,350 350,0 350,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0)))',0)),32200000)); SELECT ST_ASTEXT(ST_GEOMCOLLFROMWKB(ST_ASWKB(ST_GEOMCOLLFROMTEXT('GEOMETRYCOLLECTION(POINT(-199 5), POLYGON((0 0,10 0,10 10,0 10,0 0)), MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4,4 6,6 6,6 4, 4 4)),((0 0,-2 -2,0 -2, 0 0))))',0)), 32200000)); --echo # Clean up DROP PROCEDURE gis_wkb_funcs; DROP SPATIAL REFERENCE SYSTEM 31000000; DROP SPATIAL REFERENCE SYSTEM 31100000; DROP SPATIAL REFERENCE SYSTEM 31200000; DROP SPATIAL REFERENCE SYSTEM 31300000; DROP SPATIAL REFERENCE SYSTEM 32000000; DROP SPATIAL REFERENCE SYSTEM 32100000; DROP SPATIAL REFERENCE SYSTEM 32200000; --echo # --echo # WL#11096 Don't do Cartesian computations on geographic geometries --echo # --echo # Assume SRID 10 is not defined. Should raise warning. DO ST_ASBINARY(x'0A000000010100000000000000000000000000000000000000'); DO ST_ASWKB(x'0A000000010100000000000000000000000000000000000000');