Skip to content

Instantly share code, notes, and snippets.

@scottyab
Created May 3, 2012 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottyab/2586159 to your computer and use it in GitHub Desktop.
Save scottyab/2586159 to your computer and use it in GitHub Desktop.
Quick and dirty util to convert a lat/long into a uri for google static maps.
/**
* simple util to build the static google map url for the lat/long
* @param latitude
* @param longitude
* @return static google map url
*/
public static Uri buildStaticGoogleMapUrlForAddress(String latitude, String longitude){
Builder builder = Uri.parse("http://maps.google.com/maps/api/staticmap").buildUpon();
builder.appendQueryParameter("center", latitude+","+longitude);
builder.appendQueryParameter("zoom", "15");
builder.appendQueryParameter("size", "50x50");
builder.appendQueryParameter("sensor", "false");
builder.appendQueryParameter("maptype", "roadmap");
builder.appendQueryParameter("scale", "1");
Uri uri = builder.build();
return uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment