ST_GeometryFromWKB,ST_GeomFromWKB

Syntax

GEOMETRY ST_GeometryFromWKB(VARCHAR WKB)

Description

将一个标准 WKB(Well-known binary)转化为对应的内存的几何形式

example

  1. mysql> select ST_AsText(ST_GeometryFromWKB(ST_AsBinary(ST_Point(24.7, 56.7))));
  2. +------------------------------------------------------------------+
  3. | st_astext(st_geometryfromwkb(st_asbinary(st_point(24.7, 56.7)))) |
  4. +------------------------------------------------------------------+
  5. | POINT (24.7 56.7) |
  6. +------------------------------------------------------------------+
  7. 1 row in set (0.05 sec)
  8. mysql> select ST_AsText(ST_GeomFromWKB(ST_AsBinary(ST_Point(24.7, 56.7))));
  9. +--------------------------------------------------------------+
  10. | st_astext(st_geomfromwkb(st_asbinary(st_point(24.7, 56.7)))) |
  11. +--------------------------------------------------------------+
  12. | POINT (24.7 56.7) |
  13. +--------------------------------------------------------------+
  14. 1 row in set (0.03 sec)
  15. mysql> select ST_AsText(ST_GeometryFromWKB(ST_AsBinary(ST_GeometryFromText("LINESTRING (1 1, 2 2)"))));
  16. +------------------------------------------------------------------------------------------+
  17. | st_astext(st_geometryfromwkb(st_asbinary(st_geometryfromtext('LINESTRING (1 1, 2 2)')))) |
  18. +------------------------------------------------------------------------------------------+
  19. | LINESTRING (1 1, 2 2) |
  20. +------------------------------------------------------------------------------------------+
  21. 1 row in set (0.06 sec)
  22. mysql> select ST_AsText(ST_GeometryFromWKB(ST_AsBinary(ST_Polygon("POLYGON ((114.104486 22.547119,114.093758 22.547753,114.096504 22.532057,114.104229 22.539826,114.106203 22.542680,114.104486 22.547119))"))));
  23. +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | st_astext(st_geometryfromwkb(st_asbinary(st_polygon('POLYGON ((114.104486 22.547119,114.093758 22.547753,114.096504 22.532057,114.104229 22.539826,114.106203 22.542680,114.104486 22.547119))')))) |
  25. +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | POLYGON ((114.104486 22.547119, 114.093758 22.547753, 114.096504 22.532057, 114.104229 22.539826, 114.106203 22.54268, 114.104486 22.547119)) |
  27. +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. 1 row in set (0.03 sec)
  29. mysql> select ST_AsText(ST_GeomFromWKB(ST_AsBinary(ST_Polygon("POLYGON ((114.104486 22.547119,114.093758 22.547753,114.096504 22.532057,114.104229 22.539826,114.106203 22.542680,114.104486 22.547119))"))));
  30. +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | st_astext(st_geomfromwkb(st_asbinary(st_polygon('POLYGON ((114.104486 22.547119,114.093758 22.547753,114.096504 22.532057,114.104229 22.539826,114.106203 22.542680,114.104486 22.547119))')))) |
  32. +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | POLYGON ((114.104486 22.547119, 114.093758 22.547753, 114.096504 22.532057, 114.104229 22.539826, 114.106203 22.54268, 114.104486 22.547119)) |
  34. +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. 1 row in set (0.03 sec)

keywords

ST_GEOMETRYFROMWKB,ST_GEOMFROMWKB,ST,GEOMETRYFROMWKB,GEOMFROMWKB,WKB