【问题标题】:Get geocode from autocomplete places从自动填充位置获取地理编码
【发布时间】:2014-09-23 17:14:34
【问题描述】:

我正在使用本教程来显示我的用户地点列表,他/她可以在标记一些字母后选择。 https://developers.google.com/places/documentation/autocomplete?hl=pl

是否有任何解决方案来获取拾取地点的地理编码?我不想使用 Google Geocoder,因为它只有在用户重新启动他/她的设备时才有效。

请帮忙 ;-)

【问题讨论】:

    标签: android google-maps google-geocoder


    【解决方案1】:
            utf8s = location.getBytes("UTF-8");
            String place = new String(utf8s, "UTF-8");
            place = place.trim().replace(" ", "+");
    
            HttpGet request =
            new HttpGet("https://maps.googleapis.com/maps/api/geocode/json?address="+place+",+CA&key=AIzaSyAXDKR0cSN7kp4tfuUspGZt-zTW5IAa6hM");
    
            result = httpclient.execute(request, handler);
            JSONObject response = new JSONObject(result);
            JSONObject geometry = response.getJSONArray("results").getJSONObject(0).getJSONObject("geometry");
    
            JSONObject location= geometry.getJSONObject("location");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-14
      • 2014-10-07
      • 1970-01-01
      • 2012-10-25
      • 1970-01-01
      • 2015-07-02
      相关资源
      最近更新 更多