Reputation: 237
I want to clear that I am not trying to embed google street view in my website.
What I am trying to do is to have a URL link to be displayed in my website which will take the users who click the google street view link to Google website and display a street view.
I have Lat/Lng stored in a database. So I am writing a php code to get those to work with URL.
For example:
https://www.google.com/maps/@38.214969,-122.1065172,10z
It works with map display. I can click the url and go to Google Maps and its displayed.
But I want a link to work with streetview aswell and that will take them directly to street view of that lat/lng.
Thank You.
Upvotes: 1
Views: 3726
Reputation: 6921
If you just want a static street view image, you can use the Google Street View Image API.
Sample usage:
https://maps.googleapis.com/maps/api/streetview?size=400x400&location=40.720032,-73.988354&fov=90&heading=235&pitch=10
Just put your lat/lng value for location
parameter.
If you want to use interactive street view, you have to use Javascript Street View Service, here is a sample usage: https://developers.google.com/maps/documentation/javascript/examples/streetview-simple
You just set the lat/lng in new google.maps.LatLng(lat, lng);
then call the new google.maps.StreetViewPanorama()
function.
Upvotes: 1