Geocoding and inverse geocoding are similar, here is a summary of inverse geocoding, according to latitude and longitude to resolve the address. Android side of the inverse geocoding is mainly two (not including the German, Baidu) is the use of Android system Geocoder class to parse (this method is outdated and impractical, often failed, in China and Indonesia have test data, and some cell phone castrated, This method if you want to know please refer to http://dev.10086.cn/news/technologyproduct/4859.html); another is to use Google's Web API;
Please open VPN click Experience:http://maps.google.com/maps/api/geocode/json?latlng=39.910093,116.403945&language=zh-cn& Sensor=false. For detailed parameters, see Google's official note:HTTPS://DEVELOPERS.GOOGLE.COM/MAPS/DOCUMENTATION/GEOCODING/INTRO?HL=ZH-CN here is an introduction to the use of Android:
1. Callback public interface Locationcallback {void geocodesuccess (string address) for the result, void Geocodefailure (string address);
2.geocode Package/** * * * @author [email protected] */public class BipGeoCoder { private List<RealTimeAddrGeoDataBean> realtimeaddrgeodatabeans=null; private requestqueue mqueue = null; private context context; private string address; public Bipgeocoder (Context context) { super (); this.context = context; } /** * get address via web service * */ public void GetAddress (final double latitude, final double longitude,final string Defaddress,final locationcallback locationcallback) { &nBsp String requesturl=volleyparamsbuild.newbuilder (). Putparam ("language", "EN-WW") //en-ww can be replaced by business logic with different national languages . Putparam ("latlng", latitude+ "," +longitude) .build (). toString (); address=defaddress ; mqueue=gethttputils.getinstance (context). Getrequestqueue (); jsonobjectrequest stringrequest = new jsonobjectrequest (requesturl, null, new Response.Listener<JSONObject> () { @Override public void onresponse (Jsonobject response) { typefactory tf = jsonutil.getmapper (). GetTypeFactory (); javatype jt = tf.constructparametrictype ( List.class, realtimeaddrgeodatabean.class); try { string json = response.getstring (" Results "). ToString (); realtimeaddrgeodatabeans = Jsonutil.getmapper (). ReadValue (JSON,&NBSP;JT); } catch (jsonparseexception e) { &Nbsp; e.printstacktrace (); } catch (jsonmappingexception e) { e.printstacktrace (); } catch (ioexception e) { e.printstacktrace (); } catch (jsonexception e) { // TODO Auto-generated catch block e.printstacktrace (); } if (realtimeaddrgeodatabeans!=null&& Realtimeaddrgeodatabeans.size () >0) {&NBSp; address=realtimeaddrgeodatabeans.get (0). getFormatted_ Address (); //here should control access to refresh addresses again. } locationcallback.geocodesuccess (address);// &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;LOG.D ("Addr", "Geocoding:" +address); } }, new response.errorlistener () { @Override public void onerrorresponse (volleyerror error) { locationcallback.geocodefailure (address); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;LOG.E ("Addr", Error.tostring ()); } }); mqueue.add (stringrequest); } }
3. Use the demo new Bipgeocoder (Getactivity ()). GetAddress (Obj.getlatitude (), Obj.getlongitude (), locationdef,new Locationcallback () {@Override public void geocodesuccess (String address) {//TODO auto-generated method stub LOG.E ("Addr", "geocodesuccess:" +address); } @Override public void geocodefailure (String address) {//TODO auto-generated Method Stub log.e ("Addr", "Geo Codefailure: "+address); } });
At last:
The following is from GOOGLEHTTPS://DEVELOPERS.GOOGLE.COM/MAPS/DOCUMENTATION/GEOCODING/INTRO?HL=ZH-CN, please turn over the wall before use
-----------------------------------------------------------
The Google Maps Geocoding API
This service was also available as part of the Google Maps JavaScript API, or the Java and Python client Libraries.
What is Geocoding?
Geocoding is the process of converting addresses (like "Amphitheatre Parkway, Mountain View, CA") into geographic coo Rdinates (like latitude 37.423021 and longitude-122.083739), which-can use-to-place markers on a map, or position the Map.
Reverse geocoding is the process of converting geographic coordinates into a human-readable address. The Google Maps Geocoding API ' s reverse Geocoding service also lets you find the address for a given place ID.
The Google Maps Geocoding API provides a direct-to-access these services via an HTTP request.
Before you Begin
This document was intended for website and mobile developers who want to use geocoding data within maps provided by one of The Google Maps APIs.
this Service is generally designed for geocoding static (known in advance) addresses for placement of application content on a Map ; This service was not designed to respond in real time to user input, For example. For dynamic geocoding (for example, within a user interface element), consult the documentation for the Google Maps JavaScript API Client Geocoder and/or the Google Play Services location APIs.
Geocoding is a time and resource intensive task. Whenever possible, pre-geocode known addresses (using the Google Maps Geocoding API described here or another Geocoding SE Rvice), and store your results in a temporary cache of your own design.
To use the Google Maps Geocoding API, you need an API key.
GET A KEY USAGE LIMITS
Google Maps Geocoding API Request Format
A Google Maps Geocoding API request must be of the following form:
Https://maps.googleapis.com/maps/api/geocode/output?parameters
output where may be either of the following values:
To access the Google Maps Geocoding API over HTTP, use:
Http://maps.googleapis.com/maps/api/geocode/output?parameters
HTTP is isn't recommended for applications that include sensitive user data, such as a user's location, in requests.
Some parameters is required while Some is optional. Parameters is separated using the ampersand ( & ) character.
Google Maps API for work users must include valid client and signature parameters with Thei R Geocoding requests. Please refer the Google Maps API for work Web Services for more information.
The rest of this page describes geocoding and reverse geocoding separately, because di Fferent parameters is available for each type of request.
Geocoding (Latitude/longitude Lookup)
Required parameters in a geocoding request:
-
address -the Street address so want to geocode, in the format used by the NAT Ional Postal Service of the country concerned. Additional address elements such as business names and unit, suite or floor numbers should is avoided. Refer to , the FAQ for additional guidance.
or
components -a component filter for which, wish to obtain a geocode. See , Component Filtering for more information. The components filter would also be accepted as a optional parameter if an address &NB SP; is provided.
-
key -your application ' s API key. This key identifies your application for purposes of quota management. Learn how to get a key.
Optional parameters in a geocoding request:
-
bounds -the bounding box of the viewport within which to bias geocode results more prominently. This parameter would only influence, not fully restrict, results from the Geocoder. (For more information see Viewport biasing below.)
-
language -the language in which to return results. See the List of supported domain languages. Note that we often the update supported languages so the this list is not being exhaustive. If language is not supplied, the Geocoder would attempt to use the native language of the domain from which the reques T is sent wherever possible.
-
region -the Region code, specified as a ccTLD ("top-level domain") two-character value. This parameter would only influence, not fully restrict, results from the Geocoder. (For more information See region biasing below.)
-
components -the Component filters, separated by a pipe ( | ). Each component filter consists of a component:value pair and would fully restrict the results from the Geocoder. For more information see Component Filtering, below.
Android Inverse geocoding geocoding