Get city cordinates by city name

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Get city cordinates by city name

Postby Kamal » Mon Jun 08, 2009 2:18 pm

Hi All,

I am trying to animate map to user defined City...

I am not sure if this is the way... Here is my code :

String req_uri = "http://maps.google.com/maps/geo?output=json&oe=utf-8&q=<CityName>&key=<Map_API_Key>";
req_uri = req_uri.replace(" ", "%20");

HttpClient httpClient = new DefaultHttpClient();

try
{
HttpGet method = new HttpGet(new URI(req_uri));
HttpResponse response = httpClient.execute(method);

if (response != null)
{
result = response.getEntity().toString();
}
}
catch (Exception e)
{
Log.d("HTTP Error", e.toString());
}


By doing so, I get exception at HttpResponse response = httpClient.execute(method);...

The Exception is :
java.net.UnknownHostException: Host is unresolved: maps.google.com:80

Helps are appreciated...... :)
Kamal
Junior Developer
Junior Developer
 
Posts: 23
Joined: Wed May 27, 2009 11:15 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests