I was wondering if anyone could point me in the direction of a sample or examples of streetview working within a js api.
Thanks
Si
initViewer: function(llPoint){ // summary: // // mapPoint: esri.geometry.Point // In UTM console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); var svPoint = new google.maps.LatLng(llPoint.y, llPoint.x); var panoramaOptions = { position: svPoint, pov: { heading: 0, pitch: 0, zoom: 1 } }; this.panorama = new google.maps.StreetViewPanorama(dojo.byId("streetview-container-inner"), panoramaOptions); this.svService = new google.maps.StreetViewService(); this.validateLocation(svPoint); this.wireEvents(); }, repositionViewer: function(llPoint){ // summary: // Points the viewer to a new position after the user clicks on the map // llPoint: esri.geometry.Point projected to lat long console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); var svPoint = new google.maps.LatLng(llPoint.y, llPoint.x); this.panorama.setPosition(svPoint); this.validateLocation(svPoint); }, onPovChanged: function(){ // summary: // Fires when the point of view of the streetview viewer is changed. // Updates the graphic's orientation. //console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); var symbol = this.graphic.symbol.setAngle(this.panorama.getPov().heading); this.graphic.setSymbol(symbol); }, validateLocation: function(pnt){ // summary: // Checks to make sure that there is a valid panorama for the location // pnt: google.maps.LatLng console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); this.svService.getPanoramaByLocation(pnt, 50, function(data, status){ if (status != "OK"){ dojo.style("no-data-message", "display", "block"); } else { dojo.style("no-data-message", "display", "none"); } }); },
Not sure what the problem is. I'm able to reach the site with no problems from outside of our network. Maybe our server was having problems?
Here is some of the relevant code:initViewer: function(llPoint){ // summary: // // mapPoint: esri.geometry.Point // In UTM console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); var svPoint = new google.maps.LatLng(llPoint.y, llPoint.x); var panoramaOptions = { position: svPoint, pov: { heading: 0, pitch: 0, zoom: 1 } }; this.panorama = new google.maps.StreetViewPanorama(dojo.byId("streetview-container-inner"), panoramaOptions); this.svService = new google.maps.StreetViewService(); this.validateLocation(svPoint); this.wireEvents(); }, repositionViewer: function(llPoint){ // summary: // Points the viewer to a new position after the user clicks on the map // llPoint: esri.geometry.Point projected to lat long console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); var svPoint = new google.maps.LatLng(llPoint.y, llPoint.x); this.panorama.setPosition(svPoint); this.validateLocation(svPoint); }, onPovChanged: function(){ // summary: // Fires when the point of view of the streetview viewer is changed. // Updates the graphic's orientation. //console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); var symbol = this.graphic.symbol.setAngle(this.panorama.getPov().heading); this.graphic.setSymbol(symbol); }, validateLocation: function(pnt){ // summary: // Checks to make sure that there is a valid panorama for the location // pnt: google.maps.LatLng console.log(this.declaredClass + "::" + arguments.callee.nom, arguments); this.svService.getPanoramaByLocation(pnt, 50, function(data, status){ if (status != "OK"){ dojo.style("no-data-message", "display", "block"); } else { dojo.style("no-data-message", "display", "none"); } }); },
Heming Zhu,
Thanks you so much for that wonderful Street View sample. Love how this can easily work with the ArcGIS JS API. I'm assuming this should work with ArcGIS JS API version 3.15, correct? How about 4.0 beta3? I plan to test soon, but at any rate, many, many thanks for your sample!
David