问题
I'm drawing some Markers and Polylines on Google Maps v3.exp.
When I switch to StreetView, the markers are there, Polylines are not. Searched over the Google, SO, and all other known resources, and surprisingly there are absolutely no hints whatever about this particular question. Does anyone have any deeper information about the issue or is it hopeless to display for example some road information overlay on Streetview?
A bit on different topic (although, related) - second thing I tried in the context was to use THREE.js canvas with lines above Streetview, using Streetview Panorama Position/POV - in there i bumped into more stranger problem - did not manage anyhow to set PerspectiveCamera settings to match Streetview imagery to my painted objects. Using FOV of increments from 45 to 75 degrees on first level zoom gave no good matches although it DOES resemble correct result I need to see at the end.
UPDATED: for first case created simple JSFiddle. As you can see when switching to Streetview, marker is visible. Simple Polyline is not.
<div id="map" style="width: 500px; height: 500px;" />
<script type="text/javascript">
var map = new google.maps.Map(
document.getElementById('map'),
{zoom: 18, center: new google.maps.LatLng(59.4372, 24.7453), mapTypeId: google.maps.MapTypeId.TERRAIN});
var marker = new google.maps.Marker({map: map, position: new google.maps.LatLng(59.4372, 24.7453)});
var polyline = new google.maps.Polyline({map: map, path: [
new google.maps.LatLng(59.4372, 24.7453),
new google.maps.LatLng(59.4572, 24.7553)
], strokeColor: '#ff0000', strokeWeight: 5});
</script>
回答1:
Polylines are not supported in StreetView.
From the StreetView documentation
Overlays within Street View
Currently, the types of overlays which are supported on Street View panoramas are limited to Markers, InfoWindows and custom OverlayViews.
来源:https://stackoverflow.com/questions/31646669/drawing-polylines-on-google-maps-streetview