how to determine house/block number, from gps coordinate - google-maps

Is it possible to extract the exact location of a marker on a map? If I know that the marker is placed at (x,y) coordinate, With google maps I can see what street that is, but can I also get the huse number, or some more detailed address?

The answer is Yes and No.
The Google Maps API geocoder will reverse geocode a location to an address, and that may well do exactly what you want. Or it may not: geocoding is not an exact science and some guesswork might be involved.
Google does have "rooftop" data for some areas, and if that's the case the data will indicate "Rooftop" and provide the exact address.
In other places the address is found by interpolation -- Number 2 is at one intersection, Number 100 is at the next intersection, so a location which is at 60% of the distance between the junctions is... number 60, right? Maybe. But it's a reasonable guess and likely to be right.

Related

Google Maps Geocoder: Reference Position for Plain Location Names

I'm using the google maps api for geocoding addresses. If I geocode a plain location name (e.g. Munich) the api returns corresponding latitude and longitude.
To which position do these coordinates refer to? Is it the (geographical) center of the location or the position of the administrative headquarter or what else?
They refer to the equator which is latitude=0° and the prime meridian which is longitude=0°. This represents the central point (starting point).
You can look at it as to the Cartesian coordinate system starting from (0,0)=(x,y) and retrieving all the other places by changing the x(long) and y(lat) coordinates. So yes, the answer is geographical centre.
EDIT:
url (video): https://www.youtube.com/watch?v=Spel7vfkpNc starting at 2:43
Basically, companies within the country decide on which lat, long will a city, country when searched appear. For example if you are searching for London the pin point will be assigned to particular coordinates depending on the company decision.

Google Maps API v3 getPanoramaByLocation (StreetView)

I'm working on a project that picks random locations world-wide and need some functionality from Google Street View. I'm working with API v3 of Google Maps. The question I have is with the getPanoramaByLocation method. According to the Google docs, getPanoramaByLocation is :
"Retrieves the StreetViewPanoramaData for a panorama within a given radius of the given LatLng. The StreetViewPanoramaData is passed to the provided callback. If the radius is less than 50 meters, the nearest panorama will be returned."
The part I'm interested in is where it says "less than 50 meters, returns nearest panorama." So, for example, if I put in coordinates for somewhere in the middle of the Congo (where there isn't a street view for miles and miles), it should return a panorama of the nearest available street view. But it's not, it's returning null every time.
Is there a limit to how far away it looks?
Here's my Fiddle :
http://jsfiddle.net/nrJBP/1/
Thanks all, and hopefully this helps anyone in the future.
The service searches within the radius you give, as the docs state. You specify the maximum radius.
The service could find any Panorama data within the radius, except if you specify 50m, when it will always find the nearest (within that 50m).
You can use the google.maps.StreetViewStatus. If the request was successful, it will return OK. If there are no nearby panoramas, it will return ZERO_RESULTS.

Google Map Distance Calculation

Does anyone know if Google Maps consider elevations and the actual path on earth to calculate distance between two points or it only considers geographical locations for distance measurement?
If you are referring to using google.maps.DistanceMatrixRequest then yes, it considers the actual route when calculating distance, based on the option provided in travelMode
code.google.com reference
When there is no established route (at least known to google) i'm sure (from experience) the response is the distance 'as the crow flies' between 2 lat/long locations. [experience based off making the request for a path that bisected a large lake]

highlight a list of streets on a map

We have a database of addresses that we deliver to. It consists of the following data;
StreetName
NumberFrom
NumberTo
ZipcodeId (points to seperate table with zipcodes, which holds cityName)
StoreId
Would it be possible to highlight all those addrresses on a map like GoogleMaps (preferred), Bing, OpenStreetMap, etc. ?
I know how to add polylines, and have done geocoding in the past for addresses.
A possible issue with the data, is where it covers whole street they practise have been to just set the NumberTo to 9999. If i plot an address into google Earth with 'StreetName 999, City' it will place the point in the middle of the length of the street.
Also tried a random number, and it placed the marker on a building instead of on the street.
I don't know if it's different for GoogleMaps..
Update
I think that the DirectionsService in GoogleMaps API is the way to go, now i only need to figure out if and how i can use it multiple times on a map.
Success!
I was able to iterate over all the addresses, doing a DirectionsService request for each addres, from start of street to end of street. Extract the GeoPoints used by DirectionsDisplay, stored it to the database and is now able to draw Polylines on a map for each road.
I could iterate over the addresseseach time the map is shown (in-house use only). But still this would be a performance issue, and also unsure if how many request Google will handle per day. By storing it in DB i only need Google to calculate it once.
It can, but only in certain areas of the world - e.g. US
But you need to prepare your adresses - lets say in div/spans - then on onload document, you calll the API
I did this using Lat/Lng from a Garmin Edge - the difference is that you need to translate your addresses into lat/lng, before you can position these on the map canvas.
Mike
Yes you can convert the Address to a GeoPoint and then plot the GeoPoints on the Map. Start by looking here

Is there a way to determine if a particular address is along a route within x miles?

Is there a way to determine if a particular address is along a route within x miles? Is there support for this in the Google maps API?
I have a database of addresses and I am trying to figure out which locations lie along a given route as determined by the Google Maps API.
You can set the getPolyline option, on the GDirectionsOptions optional parameter, to the GDirections load request. This will get you the polyline data for the route.
Once you have this data you can iterate over each point in the polyline and determine the distance to each of your own datapoints (you can use the GLatLng distanceFrom method to calculate the distance).
Once you have the shortest distance to your route for each of your data points, you can and work out, based on some tolerance, if the point lies on the route.
Edit:
Although it is fine to call the GLatLng distanceFrom method repeatedly (it is just a utility method to get the distance between two points), I realized my answer simplifies the problem. To get an accurate distance from the route, you will need to determine the distance from the polyline between the closest two points (not just the distance from each point).
Bill Chadwick has "Distance of Point to Polyline or Polygon" code at the bottom of this page, which could prove useful.