4
A
答えて
0
使用Geocoderクラス。使用するのは難しくありませんし、getFromLocationName
を使用することもできます。このクラスを他の方法で使うこともできます。つまり、(lat、lon)を入力してそこに住所を取得することです。
Androidコードでやりたいと思っています.Javascriptを使いたいのであれば、Google map's APIを別の答えとして指摘してください。
3
searchedAddress - >(都市名/住所/郵便番号)にすることができます。
public boolean getLatitudeAndLongitudeFromGoogleMapForAddress(String searchedAddress){
Geocoder coder = new Geocoder(IPlant.iPlantActivity);
List<Address> address;
try
{
address = coder.getFromLocationName(searchedAddress,5);
if (address == null) {
Log.d(TAG, "############Address not correct #########");
}
Address location = address.get(0);
Log.d(TAG, "Address Latitude : "+ location.getLatitude();+ "Address Longitude : "+ location.getLongitude());
return true;
}
catch(Exception e)
{
Log.d(TAG, "MY_ERROR : ############Address Not Found");
return false;
}
}
4
がネット
private static JSONObject getLocationInfo(String address)
{
StringBuilder stringBuilder = new StringBuilder();
try {
address = address.replaceAll(" ","%20");
HttpPost httppost = new HttpPost("http://maps.google.com/maps/api/geocode/json?address=" + address + "&sensor=false");
HttpClient client = new DefaultHttpClient();
HttpResponse response;
stringBuilder = new StringBuilder();
response = client.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream stream = entity.getContent();
int b;
while ((b = stream.read()) != -1) {
stringBuilder.append((char) b);
}
} catch (ClientProtocolException e) {
Log.i("getLocationInfo ClientProtocolException", e.toString());
} catch (IOException e) {
Log.i("getLocationInfo IOException", e.toString());
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject = new JSONObject(stringBuilder.toString());
} catch (JSONException e) {
// TODO Auto-generated catch block
Log.i("getLocationInfo JSONException", e.toString());
}
return jsonObject;
}
private static boolean getLatLong(JSONObject jsonObject)
{
try {
longitute = ((JSONArray)jsonObject.get("results")).getJSONObject(0).getJSONObject("geometry").getJSONObject("location").getDouble("lng");
Log.i("Log1", longitute1+"");
latitude = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lat");
Log.i("lat1", latitude1+"");
} catch (JSONException e) {
longitute=0;
latitude = 0;
Log.i("getLatLong", e.toString());
return false;
}
return true;
}
経由で地理座標を取得します
関連する問題
- 1. 都市の緯度と経度を取得する方法は?
- 2. iPhoneのGoogleマップ - 都市名と国名by経度と緯度
- 3. 特定の都市から緯度と経度を取得するandroid
- 4. PostgreSQLで緯度と経度から都市名を検索するには?
- 5. 緯度と経度から市、州、国を取得
- 6. 指定された都市名から経度と緯度を取得する簡単なAPI
- 7. Googleマップ - 経度と緯度から国、地域、都市名を取得する(PHP)
- 8. Googleのストリートビューから緯度/経度/緯度/緯度/経度を取得する
- 9. 都市/国名で緯度と経度の境界を取得する方法android
- 10. restfbから緯度、経度を取得
- 11. 緯度経度から国を取得
- 12. jxmapviewer2から緯度経度を取得
- 13. Swiftで緯度と経度から市の名前と国を検索
- 14. アンドロイドで経度と緯度で都市の気温を調べる方法は?
- 15. 経度と緯度を国または都市に変換するには?
- 16. 経度と緯度を取得
- 17. 都市のすべての地域の緯度経度値を取得する方法
- 18. アンドロイドから緯度と経度を取得できません
- 19. 検索ボックスから緯度と経度を取得
- 20. マーカから緯度と経度を取得する方法
- 21. 作成方法緯度と経度からLogstash geo_pointを取得
- 22. モバイルデバイスから緯度と経度を取得する方法
- 23. Googleマップから緯度と経度を取得するapi
- 24. Google GeoCoding APIから緯度と経度を取得する
- 25. マップボックスでアドレスから緯度と経度を取得
- 26. データベースから同様の経度と緯度を取得する
- 27. facebookから緯度と経度を取得する
- 28. GpsMyLocationProvider(OSMdroid)から経度と緯度を取得
- 29. Googleマップ:地図要素から緯度と経度を取得
- 30. ポリラインオブジェクトから緯度と経度を取得する方法