-2

如何转换此 GPS 消息内容“lat:14.674513 long:120.549137 speed:8.95 T:13/09/24 20:27 bat:50% http://maps.google.com/maps?f=q&q=14.674513, 120.549137&z=16 " 从数据库中转换为纬度和经度值,以便能够在地图中绘制此坐标?

4

1 回答 1

0

试试这个代码:

$gps = 'lat:14.674513 long:120.549137 speed:8.95 T:13/09/24 20:27 bat:50%';
preg_match('/lat:(\d+\.\d+) long:(\d+\.\d+)/', $gps, $matches);
unset($matches[0]);
$params = array(
    'f' => 'q',
    'q' => implode(',', $matches),
    'z' => 16,
);
$query = 'http://maps.google.com/maps?' . http_build_query($params);
于 2013-10-22T07:59:53.670 回答