mysql point 类型如 POINT(118.624653 31.919936)
对应十六进制 000000001010000000a4693905af7ad504eb96afce08bef304
Internal Geometry Storage Format
https://dev.mysql.com/doc/refman/5.7/en/gis-data-formats.html
php 函数 unpack对应解析
var_dump( unpack('h*', $l), unpack('ISRID/corder/Itype/dx/dy ', $l));array(1) { [1]=> string(50) "000000001010000000a4693905af7ad504eb96afce08bef304" }array(5) { ["SRID"]=> int(0) ["order"]=> int(1) ["type"]=> int(1) ["x"]=> float(118.624653) ["y "]=> float(31.919936) }
参数说明
'ISRID/corder/Itype/dx/dy'ISRID: "I" 无号整数 4个byte "SRID" Spatial Reference System Identifier 空间参照标识符 0是二维平面corder: "c" byte 1个byte "order" 1是little-endian编码 0是big-endian编码Itype: "I" 无号整数 4个byte "type" Geometry types 如 0001:point 0003 polygondx: "d"倍精确浮点数 8个byte "x" x-coordinatedy: "d"倍精确浮点数 8个byte "y" y-coordinate
更多请参见
SRID
wkb格式
php unpack