GClientGeocoder
is the class that we use to get the geocoder that get us the location. We will use getLatLng() method to get latitude/longitude of any location. Check the following code. var place = "New York";
geocoder = new GClientGeocoder();
geocoder.getLatLng(place, function(point) {
if (!point) {
alert(place + " not found");
} else {
var info = "<h3>"+place+"</h3>Latitude: "+point.y+" Longitude:"+point.x;
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(info);
}
});
Code language: JavaScript (javascript)
In above code snippet we passed string “New York” and a handler function to getLatLng() method of GClientGeocoder. GClientGeocoder class will call google server for the location and when it gets the result, it pass the result to the handler function that we specified. Thus handler function will get point (GPoint) object from which we can get the latitude and longitude of location. In above code we have created a marker and placed it on the map. Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
What you describe is geocoding not reverse geocoding
Geocoding: process of finding associated geographic coordinates (often expressed as latitude and longitude) from other geographic data
http://en.wikipedia.org/wiki/Geocoding
Reverse geocoding: the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name
http://en.wikipedia.org/wiki/Reverse_geocoding
ops.. Thanks mackdk for pointing out the error. I will update the post and make it geocoding.
You might also want to edit the link to the example, it still says Reverse Geocoding.
hello everybody
i m creating a module of map in which i want to display all city of the visible part of the map
(i have database in which state_name city_name lat_of_city long_of_city)
so i want to find current state when user drag the map.
how to find when user drag the map?
and then current location
please help me
thanks
ohhhhhhhhhhh realy thanx buddy u solve my problem... currently i am working on application where the Lat/Long is required i simple get idea from ur site and find the solution... realy big help for me thanx keep it up....
@Noman, Thanks for the comment :)
Hi Viral Patel and everyone
Do you have any basic example code of Reverse geocoding? If you do, may I have it? I'm kinda new to this Reverse Geocoding stuff.
sincerely yours
Harry
I'm a total newbie and having trouble integrating your GeoCode code with the initialize function in your earlier tutorial. When a given page loads, I would like it to show the map for New York (or whatever is in that variable. Can you share a brief code example of how it would look?
Thanks very much!
how to get zipcode from the address?
hello every one
i need geocoded database for pune region.how to get it
i tried this code
and also set permission in manifest.xml internet,access_fine_location,access_coarse_location
but this project could not get location name from getFromLocation().
getFromLocation(lat.long,1) always return null
please kindly read this and help me