I am attempting to use the Google Streetview API to grab streetview images. My code works for every country except France. For some reason, when I try to grab data from anywhere in France, I just get back the gray image that says "Sorry, we have no imagery here." But, I know there is imagery there because I can use the google streetview via your google website and see the streetview.
For example, if I go to https://maps.google.com/maps/ms?ie=UTF8&oe=UTF8&msa=0&msid=101555744172859669534.00044f7fe84800c56d7a6&dg=feature and input the GPS coordinates "48.856638,2.352241", I can see the streetview data. However, if I go to http://maps.googleapis.com/maps/api/streetview?size=308x263&location=2.352241,48.856638&fov=120&key=[myAPIkey] I get back the gray image that says "Sorry, we have no imagery here." I have also tried reversing the order of the GPS coordinates in the URL string (i.e., "48.856638,2.352241"), and I still get back the image that says "Sorry, we have no imagery here."
Any idea what I'm doing wrong or why this might be occurring?
It looks like you're not getting an image because the coordinates are in the middle of a building. Try moving them to a street, like 48.857213,2.352617 and you should then get an image.
https://maps.googleapis.com/maps/api/streetview?size=308x263&location=48.857213,2.352617&fov=120
If you enter coordinates that are slightly wrong on Google Maps it will redirect you to the nearest working coordinates automatically. The api also has a function for near or close to.
Related
I am trying to create a URL that will render google maps with:
satellite map
a marker (pin)
a specified zoom level
I feel like I'm going a little crazy!?
This one is close, it is a satellite map, and has a marker, but does not respect the zoom parameter: http://maps.google.com/maps?&z=18&mrt=yp&t=k&q=40.7028722+-73.9868281
This one is close too, it has a marker and respects the zoom level, but it's not a satellite map: https://www.google.com/maps/place/40.7028722+-73.9868281/#40.7028722,-73.9868281,11z
You can tell it to use the satellite image by adding t=k
http://maps.google.com/maps?t=k&q=loc:37.9531784+-122.3383102
I you want the regular map, use t=m
I get a marker and satellite image with this approach.
Take a closer look at the URLs, the second link you posted sounds like it is almost exactly what you want but it lacks the satellite view. When I went to that link I was able to enable satellite view from the bottom left button on the map. When I did that, the URL updates to...
https://www.google.com/maps/place/40%C2%B042'10.3%22N+73%C2%B059'12.6%22W/#40.7028722,-73.9868281,56377m/data=!3m1!1e3!4m5!3m4!1s0x0:0x0!8m2!3d40.7028722!4d-73.9868281
Compare that to the original URL...
https://www.google.com/maps/place/40%C2%B042'10.3%22N+73%C2%B059'12.6%22W/#40.7028722,-73.9868281,11z/data=!4m5!3m4!1s0x0:0x0!8m2!3d40.7028722!4d-73.9868281
The original URL has a parameter specifying what looks like zulu time, in this case 11z. The satellite map that you are wanting switches that parameter out with what appears to be a zoom level specified in meters.
This is as close as I got:
http://maps.google.com/maps?t=k&q=loc:-34.887091,-56.054322&ll=-34.887091,-56.054322
It works fine most of the times, but in some mobile devices the pin does not appear in the centre of the screen.
Got some info from this site: https://moz.com/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
https://www.google.com/maps/#?api=1&map_action=map&basemap=satellite
is the way to do the URL.
Full google maps URL documentation here:
https://developers.google.com/maps/documentation/urls/get-started
I am having an issue where some coordinates are providing correct streetview image while others are off by several lots. For example, the coordinates for 42.4025192834409,-83.1636018491871 in streetview bring me to the intersection nearby. If I enter those coordinates into google maps the pin location is correct but then I can't drag the streetview icon in that section. Is there anything we can do differently with our coordinates so that they go to correct location for streetview?
When I search for the address it works as you are seeking. I think this is the discrepancy you are experiencing:
https://developers.google.com/maps/documentation/streetview/intro
The Google Street View Image API will snap to the panorama photographed closest to this location. When an address text string is provided, the API may use a different camera location to better display the specified location. When a lat/lng is provided, the API searches a 50 meter radius for a photograph closest to this location.
You may want to try reverse geocoding.
Try again now.
https://maps.googleapis.com/maps/api/streetview?size=640x480&location=42.4025192834409,-83.16360184918&fov=90
When I read your question two days ago, it was actually getting the wrong panorama. I tried again today and it finally got the closest panorama to those coordinates. I guess it was an issue on Google's end.
We try to show some adresses on StreetView using a link. We have the latitude/longitude for those adresses, and we open StreetView using :
http://maps.google.com/maps?q=&layer=c&cbll=[LATITUDE],[LONGITUDE]
This works, but StreetView is not positionned right in front of the adress. It is very near, but not perfect... Clearly not as accurate as when we search for the same adress directly in Google Maps, which adds a very precise marker right in front of the adress.
We even tried to use the Google Geocoding API to convert the adresses to latitude/longitude... Same result : by using those lat/long in the URL for StreetView, the position is near but not that precise.
How we missing something?
Is the StreetView "cbll" parameter approximate by design?
I have found location on google map and get custom iframe code with marked location. However marker always disappears from map after several days.
Here is our website about page: http://witcraft.ru/about. Location of our office was marked, but now the marker has disappeared.
Also we have same issue on other websites. How can I avoid this behavior?
Regards,
Alexey Zakharov.
Looks like the only way to ensure that marker won't disappear is to use company website name during the query.
So if you want to mark your company that has your-company.com domain you should search it on google maps and when grab embeded code. Keep in mind that your-comapany.com domain should be mentioned in company description that you send to Google Places service.
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).