【问题标题】:Convert GPS message content into just latitude and longitude将 GPS 消息内容仅转换为纬度和经度
【发布时间】:2013-10-30 23:31:54
【问题描述】:

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

【问题讨论】:

    标签: php google-maps-api-3 gps latitude-longitude


    【解决方案1】:

    试试这个代码:

    $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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-11
      • 1970-01-01
      • 1970-01-01
      • 2012-12-30
      • 1970-01-01
      • 2021-10-20
      • 2021-12-26
      • 2020-07-04
      相关资源
      最近更新 更多