Issue
I would like to implement street view like google street view in Map box. If anyone has any idea please guide me accordingly.
Solution
Note (Update): Combining non-google map with StreetView is not compliant with Google's Terms of Service: http://cloud.google.com/maps-platform/terms
Technically speaking it is possible:
You can use the Google Street View Service together with a custom mapbox map.
To create a street view panorama, you need to initialize it:
panorama = new google.maps.StreetViewPanorama(document.getElementById('panorama'), {
position: { lng: 23.332791136054766, lat: 42.69581966446731 },
pov: { heading: 165, pitch: 0 },
addressControl: false,
linksControl: true, // guide arrows
panControl: false, // compass
zoomControl: false,
/*
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
},*/
fullscreenControl: true,
fullscreenControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
},
zoom: 5,
visible: true,
mode: 'html5' // fixes bug in FF: http://stackoverflow.com/questions/28150715/remove-google-street-view-panorama-effect
});
Then you can update the panorama position based on events coming from your mapbox map:
panorama.setPov({
heading: +building.heading || 0,
pitch: +building.pitch || 0,
zoom: +building.zoom || 1
});
panorama.setPosition({
lng: +building.lng,
lat: +building.lat
});
// NOTE: this fixes broken behavior:
panorama.setVisible(false);
panorama.setVisible(true);
Alternatively, you can have a look at Mapillary which is a more open alternative to Google Street View. They are actually using mapbox-gl in their explorer UI.
Answered By - kmandov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.