【问题标题】:google map query string format for addresses instead of lat/long?地址而不是纬度/经度的谷歌地图查询字符串格式?
【发布时间】:2011-09-25 04:16:25
【问题描述】:

我正在开发一个安卓应用程序,我使用纬度/经度来绘制地图

http://maps.google.com/maps?saddr=47.295601,0.010586&daddr=47.295601,1.010586
+t‌​o:47.295601,2.010586+to:47.295601,3.010586+to:42.223501,2.011586
+to:35.215621,1.020456

但现在我想通过地址而不是纬度/经度来绘制地图。我用谷歌搜索,但没有找到任何关于从地址绘制地图的查询字符串的帮助。

【问题讨论】:

    标签: java android google-maps google-maps-api-3


    【解决方案1】:

    做同样的事情,但用逗号分隔地址的每一部分。

    http://maps.google.com/maps?saddr=47.295601,0.010586
    &daddr=123 Main Street, Houston, Texas, 77707
    +t‌​o:47.295601,2.010586
    +to:321 Avenue A, Baton Rouge, Lousiana, 68594
    +to:42.223501,2.011586
    +to:35.215621,1.020456
    

    您可以使用坐标和地址的组合。

    【讨论】:

    • 通常,当我为 Android 编程时,起始地址将是您从位置管理器收到的与用户当前位置的坐标。地址的其余部分通常采用地址形式,来自存储在数据库中或由用户输入的内容。
    【解决方案2】:

    为什么不使用地理编码器来接收 LatLng 值?

    Geocoder geocoder = new Geocoder(this, Locale.getDefault());
    List<Address> adr = geocoder.getFromLocationName(locationName, maxResults);
    

    【讨论】:

      【解决方案3】:
      猜你喜欢
      • 2011-10-19
      • 2014-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-28
      • 1970-01-01
      • 2014-04-04
      相关资源
      最近更新 更多