Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What I've done in the past is something like this. I check the StreetViewService has a 'Panorama' within 50 metres of the given location. Here's some full sample JS code which should work as is.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Streetview&lt;/title&gt; &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no" /&gt; &lt;style type="text/css"&gt; html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #streetView { height: 100%; width: 100%; } &lt;/style&gt; &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function createStreetMap(strMapCanvasID, intLat, intLong) { //create a google latLng object var streetViewLocation = new google.maps.LatLng(intLat,intLong); var panorama; //once the document is loaded, see if google has a streetview image within 50 meters of the given location, and load that panorama var sv = new google.maps.StreetViewService(); sv.getPanoramaByLocation(streetViewLocation, 50, function(data, status) { if (status == 'OK') { //google has a streetview image for this location, so attach it to the streetview div var panoramaOptions = { pano: data.location.pano, addressControl: false, navigationControl: true, navigationControlOptions: { style: google.maps.NavigationControlStyle.SMALL } }; var panorama = new google.maps.StreetViewPanorama(document.getElementById(strMapCanvasID), panoramaOptions); } else{ //no google streetview image for this location, so hide the streetview div $('#' + strMapCanvasID).parent().hide(); } }); return panorama; } $(document).ready(function() { var myPano = createStreetMap('streetView', 51.513016, -0.144424); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;h2&gt;Street View&lt;/h2&gt; &lt;div id="streetView"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And then I only call this function once the DOM has loaded (otherwise I found errors if trying to do it too soon from within an <code>initialize</code> function).</p> <pre><code>$(document).ready(function() { var myPano = createStreetMap('streetView', someLatitude, someLongitude); }); </code></pre> <p>I believe in C# instead of using the call to <code>createStreetMap</code> from within <code>$(document).ready(function() { ... });</code> you would use the <a href="http://msdn.microsoft.com/en-us/library/cc491132.aspx" rel="nofollow">WebBrowser.InvokeScript</a> method and do something like this:</p> <pre><code>object[] args = {"streetView",51.513016,-0.144424}; webBrowser1.Document.InvokeScript("createStreetMap",args); </code></pre> <p>See also: <a href="http://www.codeproject.com/Tips/60924/Using-WebBrowser-Document-InvokeScript-to-mess-aro" rel="nofollow">http://www.codeproject.com/Tips/60924/Using-WebBrowser-Document-InvokeScript-to-mess-aro</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload