google static maps api returns blue image - google-maps

I try to get the satellite example to work:
https://developers.google.com/maps/documentation/static-maps/
The url for the request is (with the correct API key...):
https://maps.googleapis.com/maps/api/staticmap?maptype=satellite¢er=37.530101,38.600062&zoom=14&size=640x400&key=API_KEY
This is the result:
Where the expected result is:
I checked the coordinates: 37.530101,38.600062 with google earth and they should bring me to the expected result.
If I look in the google developer console then I can see the requests are made.
If I try this one for example (with the key).
http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=14&size=512x512&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false&key=
Then I do get an image.
Why doesn't the first one work?

I got it.
In the url google provides it says:
?maptype=satellite¢er=37.530101,38.600062
Where
¢er
Should be:
&center
I guess someone at google had a hangover.

Related

Google Maps URL with pushpin and satellite basemap

Background Information
I can form a simple valid Google Maps URL that has a pushpin on a coordinate like so using the query parameter:
https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393
Direct link
Similarly, I can form a URL with a satellite image of the same location using the center and basemap parameters:
https://www.google.com/maps/#?api=1&map_action=map&center=47.5951518,-122.3316393&zoom=17&basemap=satellite
Direct link
Desired End Result
What I'd like to have is a satellite image like in the second URL with a pushpin. The result of this can be seen by using the first URL and pressing the 'Satellite' button on the bottom left of the map. From what I can tell, the basemap and query parameters may not be used together like below, but I'd love to be proven wrong.
https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393&basemap=satellite
Desired end result:
Direct link
I need to be able to construct the URL with a dynamic set of coordinates. I haven't found a way to manipulate the parameters in order to accomplish this.
Note: the final URL I included is an "unpacked" URL generated by Google Maps and not constructed by hand. I haven't found a way to manipulate it the way I want, and even if I could, I'm sure it's not the correct way to solve this problem.
You are right in that this can't be done with the new Google Maps APIs. The "Search" URL scheme allows pinning but no satellite view, whilst the "Display a map" scheme allows satellite views but no pinning.
However, it is possible get both pinning and satellite views by using this old, no-official-documentation, scheme:
http://maps.google.com/maps?t=k&q=loc:47.5951518+-122.3316393
The t parameter used to work with a number of different values but only two seem to currently still work:
t=m - Normal map view
t=k - Satellite view
Note that unofficial documentation for the other parameters can be found here. Some of these may also still work.
For anyone still looking for a solution in 2022, you can use the following undocumented URL scheme:
https://www.google.com/maps/place/{lat},{lng}/#{lat},{lng}/data=!3m1!1e3
This is the best solution I could find that mimic the plan-limited query URL scheme:
https://www.google.com/maps/search/?api=1&query={lat},{lon}

Auto suggestion in Google Maps is not same at web and API

I get the program with the clumsiness of data appearance on the google API,
because if we do a direct address search on maps.google.com then the suggestion data will appear more, on the contrary if using the display API suggestion less, well how to display the suggestion API can be in accordance with the results suggestion search on maps.google.com
for the demo here: http://dzkrrbb.com/demo/gojek/
120/5000
enter the place name in the address like my example "masjid al ihsan", then compare the result on maps.google.com
I think that you are using Geocoding API instead of Place Autocomplete.
If you type "masjid al ihsan" in this link, you get the same results that Google Maps.

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.

Use a URL to link to a Google map with a marker on it

I want to link to google maps at a particular location with a marker on a particular point.
It's easy to link to a location:
http://maps.google.com/?ll=XX.XXXX,XX.XXXX
But how do I drop a marker at that point too? preferably with a bit of my own text but that's just a bonus.
2017 - Google has released documentation on this see new accepted answer: https://stackoverflow.com/a/44477650/359135
In May 2017 Google launched the official Google Maps URLs documentation. The Google Maps URLs introduces universal cross-platform syntax that you can use in your applications.
Have a look at the following document:
https://developers.google.com/maps/documentation/urls/guide
You can use URLs in search, directions, map and street view modes.
For example, to show the marker at specified position you can use the following URL:
https://www.google.com/maps/search/?api=1&query=36.26577,-92.54324
For further details please read aforementioned documentation.
You can also file feature requests for this API in Google issue tracker.
This format works, but it doesn't seem to be an official way of doing so
http://maps.google.com/maps?q=loc:36.26577,-92.54324
Also you may want to take a look at this. They have a few answers and seem to indicate that this is the new method:
http://maps.google.com/maps?&z=10&q=36.26577+-92.54324&ll=36.26577+-92.54324
If you want to include a zoom level, you can use this format:
https://www.google.com/maps/place/40.7028722+-73.9868281/#40.7028722,-73.9868281,15z
will redirect to this link (per 2017.09.21)
https://www.google.com/maps/place/40%C2%B042'10.3%22N+73%C2%B059'12.6%22W/#40.7028722,-73.9868281,15z/data=!4m5!3m4!1s0x0:0x0!8m2!3d40.7028722!4d-73.9868281
This URL format worked like a charm:
http://maps.google.com/maps?&z={INSERT_MAP_ZOOM}&mrt={INSERT_TYPE_OF_SEARCH}&t={INSERT_MAP_TYPE}&q={INSERT_MAP_LAT_COORDINATES}+{INSERT_MAP_LONG_COORDINATES}
Example for Mount Everest:
http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=27.9879012+86.9253141
Full reference here:
https://moz.com/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
-- EDIT --
Apparently the zoom parameter stopped working, here's the updated format.
Format
https://www.google.com/maps/#?api=1&map_action=map&basemap=satellite&center={LAT},{LONG}&zoom={ZOOM}
Example
https://www.google.com/maps/#?api=1&map_action=map&basemap=satellite&center=27.9879012,86.9253141&zoom=14
If working with Basic4Android and looking for an easy fix to the problem, try this it works both Google maps and Openstreet even though OSM creates a bit of a messy result and thanx to [yndolok] for the google marker
GooglemLoc="https://www.google.com/maps/place/"&[Latitude]&"+"&[Longitude]&"/#"&[Latitude]&","&[Longitude]&",15z"
GooglemRute="https://www.google.co.ls/maps/dir/"&[FrmLatt]&","&[FrmLong]&"/"&[ToLatt]&","&[FrmLong]&"/#"&[ScreenX]&","&[ScreenY]&",14z/data=!3m1!4b1!4m2!4m1!3e0?hl=en" 'route ?hl=en
OpenStreetLoc="https://www.openstreetmap.org/#map=16/"&[Latitude]&"/"&[Longitude]&"&layers=N"
OpenStreetRute="https://www.openstreetmap.org/directions?engine=osrm_car&route="&[FrmLatt]&"%2C"&[FrmLong]&"%3B"&[ToLatt]&"%2C"&[ToLong]&"#Map=15/"&[ScreenX]&"/"&[Screeny]&"&layers=N"
2023 update:
I found a very easy way to implement this function.
From google maps, find your POI (point of interest) and click on it.
on left handside opening menu you will see an icon Share and click.
A modal opens and you see a sharing link input box. Next to it you will see Copy link. Go to your url and paste it like;
Drive to our office
Voila, you are done.

What is a good API to use to determine the address of a place based on its name?

I need to get the specific address (or lat/long coordinates) of a place based on that place's name.
Specifically, I need to determine the location of supermarkets in a given area so that I can use those locations as 'markers' in my implementation of google maps static maps api.
Using the following, I can if you input a specific location in the area that currently says "INSERT_LOCATION_HERE", then you will get a google map of the specified area with markers at the locations.:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|INSERT_LOCATION_HERE&sensor=false
For example (the marker indicates the local Wegmans store based on its address:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|500%20So.%20Meadow%20Street&sensor=false
If anyone knows how to do this without using google maps places api, that would be extremely helpful!
If you want to get the name as a string intead of an image, you can do it with a little help for Google. That'll match nicely with the static map that you're using.
Let's say you want to search for "Den Haag"...
Construct a URL like this, and parse the result:
http://maps.google.com/maps/geo?q=den%20haag
You can also specify the output format:
http://maps.google.com/maps/geo?q=den%20haag&output=xml
http://maps.google.com/maps/geo?q=den%20haag&output=csv
http://maps.google.com/maps/geo?q=den%20haag&output=json
You can also provide coordinates instead of a name, and get a full name+coordinates in return:
http://maps.google.com/maps/geo?q=52.0467315,4.3796239&output=json
For some reason the links don't work when you click them from this page. I guess google doesn't accept a referrer in the request, so just copy and paste the links... That works.