google maps ip address question - google-maps

I have an ip address i want to locate all the nearest places ip addresses marked with marker in google maps.
How can i achieve it ?

If you want to do this client side, consider using the Google Loader's ClientLocation. It provides IP-based geolocation:
http://code.google.com/apis/ajax/documentation/#ClientLocation
I'm not sure what you mean by nearest places, perhaps you'll then want to reverse geocode the latlng returned by google.loader.ClientLocation:
http://code.google.com/apis/maps/documentation/javascript/reference.html#Geocoder

You can use ip2location to get the location of the IP and the use Google Geocoding API to find it's coordinates and place it on a map.

Related

Google Maps Reverse Geocoding API returns nearest land address given a latlng in sea

In my project, I'm using Google Geocoding and Reverse Geocoding APIs to validate the addresses and latlngs provided by end users.
Given latlng -37.857866,144.950706, the Reverse Geocoding API (https://maps.googleapis.com/maps/api/geocode/json?latlng=-37.857866,144.950706) returns the nearest land address.
However on Google Map web page, that latlng actually is in the sea: https://www.google.com.au/maps/search/-37.857866,144.950706
Is there anyway that I can tell Google Reverse Geocoding API to not return me the nearest land address? In real project, actually I provide the API key and specify location types, e.g. https://maps.googleapis.com/maps/api/geocode/json?key=<API_Key>&location_type=ROOFTOP&latlng=-37.857866,144.950706 and I'm just thinking if the place specified by the latlng is not a ROOFTOP address, Google should return me ZERO_RESULTS.
Further update: just to clarify that in my project, customer's sites addresses are required, and some of the customers would rather provide site LatLng, therefore I need to convert the LatLng to actual address, and showing error message if a LatLng is invalid or in sea so that customer can double check. Using the nearest land address is error-prone.
If Reverse Geocoding API is not suitable for this, then please advise the proper Google Maps API for this. Thank you.

What is the web Google URL to find the directions between 2 coordinates (lat, long)?

I am trying to open up google maps in the browser by passing it 4 points. What is the scheme to launch google maps so it inputs a start coordinate and an end coordinate?
It's not offically documented, but currently this works:
https://www.google.de/maps/dir/origin_lat,origin_lng/destination_lat,destination_lng/
e.g. Chicago to Detroit:
https://www.google.de/maps/dir/41.87,-87.62/42.33,-83.04/
You may also use addresses:
https://www.google.de/maps/dir/origin_address/destination_address/
https://www.google.de/maps/dir/Chicago/Detroit/
The URL parameters for this Google API are destination and origin, here you can use adresses or coordinates as values:
https://www.google.com/maps/embed/v1/directions?origin=sydney&destination=sydney&key=...
but be aware that for this service you need an API key. When using the javascript API you don't need an API key, at least if you don't have too much traffic.

Google Map Address from latitude and longitude

I am using google map api i am fetching dynamically latitude and longitude from my database.
I want to show address for each position can any one tell me how can id that.
or can any anyone tell how this site is fetching address for each every position.
http://www.findlatitudeandlongitude.com/find-address-from-latitude-and-longitude.php#.UTpYG1c9nwk
Fetching the associated address from a coordinates is called Reverse Geocoding
The Google Maps API provides reverse geocoding in the javascript API and as a web service.
The Google Maps service is not intended for bulk use. Your best option is to store the address in your database along with the coordinates as Reverse Geocoding is not always reliable.
You can use google map api like below
http://maps.googleapis.com/maps/api/geocode/json?latlng=34.41448,-118.93753&sensor=true
Using this api,you can get address address from key
"formatted_address" : "1271 Cliff Avenue, Fillmore, CA 93015, USA"
Whole address you can get using this api.
Hope need helpful.
I'd guess that site is using the Reverse Geocoding API provided by Google.

How do I move marker to the street in front of address

I am using the google geocodeing and for a lot of the rural addresses the marker gets placed in the middle of the lot. What I need to have is the marker placed on the street in front of the address that was geocoded.
Here is a link to what I currently have for testing.
http://www.commsoft.net/maps/index.html
Any suggestions would be greatly appreciated.
You could possibly use the Google Maps API StreetViewService to get the street location you need.
Google Maps API - Directly Accessing Street View Data
Get the latLng location using the Geocoder
Send that location, a search radius, and a callback function to the streetview service:
var streetViewService = new google.maps.StreetViewService();
streetViewService.getPanoramaByLocation(location, searchRadius, callbackFunction);
The streetViewService will respond with the closest streetView photo it has to your location. In your callback function, callbackFunction(data, status), data.location.latLng will contain the location on the street where that streetview photo was taken.
Use that location for your marker.
It isn't a perfect solution, but it might be the best you can do, short of storing your own street locations in a database. The main drawback is that, in order for it to work, the address must have a streetview image. So if you are mostly concerned with rural addresses, it might not work for you.
The best way to display multiple addresses on a Google Maps API map is to geocode them off-line and store the coordinates in your database (or where ever you are getting the addresses from). If you are going to display more than 10-15 markers using the geocoder or the directions service, you will run into the quota/rate limits.
If you geocode the addresses off line, if you don't like the values that are returned by the geocoder, you can fix them.
An option for programmatically getting coordinates on the street nearest an address is to use the directions service (get directions from the address of interest to itself, should result in a zero length route with the same start and end point on the road at the point closest to the address).
example using your addresses

Confused - How to get the geocode for an address (Google Maps)

I create a small web app, the user add his address and I want to show the map for his address.
Is there a way to get the latitude and longitude for an address? with Google Maps.
Or you could use the geocoding service from google maps: http://code.google.com/apis/maps/documentation/javascript/services.html#Geocoding
Here's a simple example for it: http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-simple.html
Yes there is. It is called geocoding. Here is Google's API: http://code.google.com/apis/maps/documentation/geocoding/