简体   繁体   中英

To pass latitude n longitude values to Google Maps API

I am working on a project wherin the GPS sends the latitude and longitude value of a place implicitly to google Maps API. I have come across the following link :

http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true_or_false

In this, instead of directly specifying the latlong values, is there any way i can create a parameter "latlong" inside my program and could be passed to the google maps?

String latlng="40.714224 -73.961452"; String location[]=latlng.split(" ",",");

From the above code ,the latlng values will be spitted and stored in the form of arrays.When you want to specify URL.methion in the below form

" http://maps.googleapis.com/maps/api/geocode/json?latlng= "+location[0]+","+location[1]+"&sensor=true

Then the remaining things is as usual ie handling JSON data.I hope you are using the javascript or java.The above code will be helpfull for you.please ignore ,if this answer is not appropriate for you.

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM