Akhilesh Kumar
Akhilesh Kumar

Reputation: 919

Why i am not getting exact location on google map using google map geocoding api

http://maps.googleapis.com/maps/api/geocode/json?address=Chopra Eye Hospital, H No-3, Pocket C-8, Sector 7, Near Rohini east Metro Station, Rohini&sensor=false

Upvotes: 0

Views: 822

Answers (1)

Sandeep
Sandeep

Reputation: 1532

Bhai, you are Geocoding not Reverse geocoding.

Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you 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.

Refer:https://developers.google.com/maps/documentation/geocoding/intro


In this question you are locating Chopra eye hospital by passing the address in url, but the url shoul not have space character .In google maps space should be replaced by +. So your url should look like

http://maps.googleapis.com/maps/api/geocode/json?address=Chopra+Eye+Hospital,+H+No-3,+Pocket+C-8,+Sector+7,+Near+Rohini+east+Metro+Station,+Rohini&sensor=false

But this will also not work because the address is Postal address .

The url for Geocoding Chopra Hospital, Rohini is:

http://maps.googleapis.com/maps/api/geocode/json?address=Chopra+Eye+Hospital,+Pradeep+Bhatia+Marg,+Rohini,+New+Delhi,+Delhi&sensor=false This will return json data which You should process and use.

Upvotes: 1

Related Questions