Google Maps Embed displaying incorrect address on directions - google-maps

I have just added a very simple code snippet to a client's website using the Google Maps Embed API. This displays all of the correct details, but when you click on the "Directions" link, a different address is displayed. You can see the problem on the web page here, http://www.picturesbyrob.co.uk/contact-us/
Anyone seen a problem like this before? I'm not sure if there's an underlying issue with the data or with the application.
Any pointers gratefully received. Thanks.

It is because the coordinates that are passed in your direction request are https://maps.google.com/maps?ll=54.033922,-0.589114&z=7&t=m&hl=en-US&gl=US&mapclient=embed&daddr=Photographer%20in%20York%20118%20Middlecroft%20Drive%20Strensall%20York%2C%20North%20Yorkshire%20YO32%205YQ%2C%20United%20Kingdom#54.033922,-1.045047
Latitude : 54.033922
Longitude : -1.045047
Which is the address you are getting on the Google Maps when you click on the direction link.
THe coordinates for the address you are looking which is 118 Middlecroft Drive, Strensall, York, York YO32 5YQ, UK are
Latitude : 54.0338228
Longitude : -1.0447040000000243
Try putting this explicitly in your request instead of geocoding it!

Related

Google autocomplete place API not suggesting few popular places

I am using https://maps.googleapis.com/maps/api/place/autocompete?key=MyKey&input=MySearchText api for auto place suggestion , but I am not getting few popular cities in response and the same place I can easily search on google map application. Can anyone please help me on this what I am doing wrong and what can be the reason google place api is not suggesting this location? I am searching for below location :
4 horner square london e1 6ew
Thanks,
When I search the '4 horner square london e1 6ew' with Geocoding API I can get this address.
https://maps.googleapis.com/maps/api/geocode/json?address=4%20horner%20square%20london%20e1%206ew&key=YOUR_API_KEY
The place ID is ChIJs2foBLQcdkgRHljoVNXS89g
The fact that this place doesn't appear in Place autocomplete is really weird. I also have ZERO_RESULTS:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=4%20horner%20square%20london%20e1%206ew&key=YOUR_API_KEY
I think you have to file an issue in the public issue tracker.

Google Maps vs Mapquest

I figure I'd drop this question here.
I wrote a curl script that gets the longitude and latitude for an address using the google maps API.
Works great!
The problem I have is that when I check the coordinates that my script generated.... on Google Maps and Mapquest the maps show different locations on the same coordinates.
In this case the coordinates are : 41.461754, -74.443577
Give it a shot. You'll see what I mean.
has anyone else experienced this problem? any solutions?
I don't rely on mapquest. They have my home 1 block from it's correct location. They show my home in what is a vacant house 1 street west. Need contact info so can advise them of their error.
I compaired it with openstreetview the result is the same as in google maps. It seems that just mapquest does not know the streets near to your position. If you scroll out the streets seems to be the same, but I live on another continent so far I don't know that environment.

Google Map : Can we add a link to get directions from current location?

Here's what I would like to do :
http://www.google.com/maps?start=geolocalize_me&destination=some address here
Google would know that the keyword "geolocalize_me" means that it should geolocalize the person and adds the direction afterwards.
Is it possible?
You would want to use the Google Maps API and the directions service, along with HTML5 geolocation. You shouldn't try to link directly to directions in maps.google.com as parameters are undocumented and subject to change.
Here's a sample that uses geolocation to find a users current position.

How do I link to Google Maps with a particular longitude and latitude?

I have a small application that gives the current location: longitude and latitude.
Now I have to browse to google maps with the longitude and latitude.
Please suggest how I can do this.
The best way is to use q parameter so that it displays the map with the point marked. eg.:
https://maps.google.com/?q=<lat>,<lng>
This schema has changed again (23rd October 2018). See Kushagr's answer for the latest.
This for a map with the marker (via aaronm's comment):
https://www.google.com/maps/?q=-15.623037,18.388672
For an older example (no marker on this one):
https://www.google.com/maps/preview/#-15.623037,18.388672,8z
The oldest format:
http://maps.google.com/maps?ll=-15.623037,18.388672&spn=65.61535,79.013672
As of today (1st November, 2020), Google provided a provision of Universal URL which works quite efficiently on cross-platforms and thus, Google recommends this method.
Syntax: https://www.google.com/maps/search/?api=1&query=<lat>,<lng>
Example :
https://www.google.com/maps/search/?api=1&query=28.6139,77.2090
(New Delhi, India)
Documentation/Source.
As of today (2014/09/23), I've found that to get marker on exact place (not an approximation) you can use:
http://www.google.com/maps/place/49.46800006494457,17.11514008755796
Additionally, if you want to specify map center and zoom:
http://www.google.com/maps/place/49.46800006494457,17.11514008755796/#49.46800006494457,17.11514008755796,17z
If you want to use satellite map type, then append /data=!3m1!1e3
http://www.google.com/maps/place/49.46800006494457,17.11514008755796/#49.46800006494457,17.11514008755796,17z/data=!3m1!1e3
And If you want terrain view of the map, then append /data=!3m1!4b1
https://www.google.com/maps/place/49.46800006494457,17.11514008755796/#49.46800006494457,17.11514008755796,17z/data=!3m1!4b1
If you want to open Google Maps in a browser:
http://maps.google.com/?q=<lat>,<lng>
To open the Google Maps app on an iOS mobile device, use the Google Maps URL Scheme:
comgooglemaps://?q=<lat>,<lng>
To open the Google Maps app on Android, use the geo: intent:
geo:<lat>,<lng>?z=<zoom>
It´s out of the scope of the question, but I think it might be also interesting to know how to link to a route. The query would look like this:
https://www.google.es/maps/dir/'52.51758801683297,13.397978515625027'/'52.49083837044266,13.369826049804715'
These are URLs that work:
http://maps.google.com/?q=<LAT>,<LNG>
https://maps.google.com/?q=<LAT>,<LNG>&ll=<LAT>,<LNG>&z=18
https://www.google.com/maps/#<LAT>,<LNG>,16z
https://maps.google.com/?q=<LAT>,<LNG>&z=16
Although (for avid readers) This is the latest from google (August 22 2017):
Maps URLs
Maps URLs with map display
Maps URLs with search action
From google
Search: When searching for a specific place, the resulting map puts a pin in the specified location and displays available place details.
Important: The parameter api=1 identifies the version of Maps URLs this URL is intended for. This parameter is required in every request. The only valid value is 1. If api=1 is NOT present in the URL, all parameters are ignored and the default Google Maps app will launch, either in a browser or the Google Maps mobile app, depending on the platform in use (for example, https://www.google.com/maps).
This works too:
https://www.google.pl/maps/#<lat>,<lon>,<zoom>z
Example.
With pointer:
https://www.google.com/maps/place/<lat>,<lon>/#<lat>,<lon>,<zoom>z
Example.
To open the google maps app in android:-
geo:<lat>,<lng>?z=<zoom>
open app with marker for give location:-
geo:<lat>,<lng>?q=<lat>,<lng>(Label,Name)
open google map in ios:-
comgooglemaps://?q=<lat>,<lng>
open google maps in browser with following parameters:-
http://maps.google.com/maps?z=12&t=m&q=<lat>,<lng>
z is the zoom level (1-21)
t is the map type ("m" map, "k" satellite, "h" hybrid, "p" terrain, "e" GoogleEarth)
q is the search query
Using the query parameter won't work, Google will try to approximate the location.
The location I want : http://maps.google.com/maps?ll=43.7920533400153,6.37761393942265
The approximate location (west of the actual location) : http://maps.google.com/?q=43.7920533400153,6.37761393942265
say easily http://www.google.com/maps/place/lat,lng format
sample url:
http://www.google.com/maps/place/30.364124,48.227034
To get your current location as start point you need to use this URL:
https://www.google.com/maps/dir/?api=1&origin=Current+Location&destination=<latitude>,<longitude>
You can fill up the destination parameter with the address, name or latitude and longitude values.
Open the following url with the latitude and longitude and zoom level.
https://maps.google.com/?q=23.22,88.32&z=8
Find your location in the Google Earth program, and click the icon "View in Google Maps". The URL bar in your browser will show the URL you need.
Open google map and show URL schemes location and location pin
UIApplication.shared.openURL(URL(string:"https://maps.google.com/?q=\(dicLocation.stringValueForKey("latitude")),\(dicLocation.stringValueForKey("longitude")),15z")!)
if you want a dir with travel mode = walking
https://www.google.es/maps/dir/'52.51758801683297,13.397978515625027'/'52.49083837044266,13.369826049804715'/data=!4m2!4m1!3e2

get link in google map info box

how do get different link of "send to friend", "print map", and "get direction" link in the marker info box related to that marker.
Is there any API for that to get this type links.??
Thanks in advance.
There is nothing explicit in the Google Maps API that will show the maps.google.com InfoWindow , you will have to build that functionality into your own GInfoWindow. For the functionality you describe, you could do the following:
send to friend - Some server side code to email your site URl to a user specified email address?
print map - Link to a cut down page that displays a Google Static Maps image (for the equivalent location). The various browsers will do a better, more predictable job of printing an image than they will a Google Map DIV.
get direction - You can use the GDirections object to GeoCode to addresses and display the driving directions between those two points (on the map and with instructions).