Adding Location• Adding a Map Activity• Obtaining a Map API Debug Key• Adding a Map View• Finding an Address with Google’s GeoCoder• Returning the choosen from the map Activity.
Cast of Characters• MapView- A Google Map ,just like the official Maps
Application
• MapActivity- An Activity that knows how to display the MapView
• GeoCoder- a class that can search for a location,returning an address with latitude and longitude.
Obtaining a Google API key• To use Google Map’s API you need an API key• One Production key and many debug keys– One debug key for every developer machine– https://developers.google.com/maps/documentat
ion/android/mapkey
Geocoder• Returns List<Address>• getFromLocation-search for addresses near
longitude and latitude• getFromLocationName-search for a location
by name• getFromLocationName-search for a location
within a “geofence” –a box defined by longitude and latitude
Longitude*1E6
• The reason they are multiplied by 1E6 is because the GeoPoint class (which is used to plot points on a Google Map) uses microdegree latitude and longitude as integers. Multiplying by 1E6 converts degrees into microdegrees. The reason Google chose to do it this way is up to debate, but it probably has to do with the fact that the Google Maps themselves are not extremely accurate, and using a raw double value to 10 or more decimal places returned by the GPS is an unnecessary level of accuracy to plot a point on a Google Map.
• SOURCE http://stackoverflow.com/questions/6125476/android-google-maps-longitude-latitude-calculation-question
GeoPoint
• 1)First you have data(Location) in degree formate. 2)By the Equation you have to multiply it by 1000000 3)now ,you have particular GEO POINT Location .
• if you have location like : Latitude:23.0395677 and Longitude:72.5660045° So, your GeoPoint(23039568,72566045);
• float lat = -23.4456f; float lng = 45.44334f; GeoPoint gp = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6));