Select to view content in your preferred language

Integrating streetview to my Flex Application urgent.......

8351
44
09-22-2010 12:59 AM
Matildaobaseki
Deactivated User
Hi All,

I did integrate Google streetview Wedge by dbechtold to my flex application ran it the first time from my flex builder, it worked, but wont display the second time i ran the flex application.


Also dbechtold  wedge  only displayed one location. I need a code( from the guru's) that when I  used the location wedge in my flex application, which uses esri geocoding Api, it registers the lalng and displays the corresponding location in google streetview panorama.


Any Ideas..................
Tags (2)
0 Kudos
44 Replies
RobertScheitlin__GISP
MVP Emeritus
Matilda,

   This is what I got working (mostly)

<!-- saved from url=(0014)about:internet -->
<html lang="en">

<!-- 
Smart developers always View Source. 

This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR. 

Learn more about Flex at http://flex.org 
// -->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--  BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!--  END Browser History required section -->

<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>

<!--  BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!--  END Browser History required section -->

<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = ${version_major};
// Minor version of Flash required
var requiredMinorVersion = ${version_minor};
// Minor version of Flash required
var requiredRevision = ${version_revision};
// -----------------------------------------------------------------------------
// -->
</script>
</head>

<body scroll="no" onload="initialize()" onunload="GUnload()">
<div id="pano" style="width: 100%; height: 50%;float:top"></div>
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

var myPano;
var panoClient;
var nextPanoId;

var sv = new google.maps.StreetViewService();
var panorama;

function initialize()
{
 panorama = new google.maps.StreetViewPanorama(document.getElementById("pano"));
 
}

function setPanorama( lat, lng )
{
 alert(lat + ", " +lng);
 var svlatLng = new google.maps.LatLng(lat,lng);
 sv.getPanoramaByLocation(svlatLng, 50, processSVData);
}

function processSVData(data, status) {
 
    if (status == google.maps.StreetViewStatus.OK) {
      //alert("Got to StreetViewStatus");      
      panorama.setPano(data.location.pano);
      panorama.setPov({
        heading: 270,
        pitch: 0,
        zoom: 1
      });
      panorama.setVisible(true);
    } else {
      alert("Street View data not found for this location.");
    }
  }
if ( hasProductInstall && !hasRequestedVersion ) {
 // DO NOT MODIFY THE FOLLOWING FOUR LINES
 // Location visited after installation is complete if installation is required
 var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
 var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

 AC_FL_RunContent(
  "src", "playerProductInstall",
  "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
  "width", "${width}",
  "height", "${height}",
  "align", "middle",
  "id", "${application}",
  "quality", "high",
  "bgcolor", "${bgcolor}",
  "name", "${application}",
  "allowScriptAccess","sameDomain",
  "type", "application/x-shockwave-flash",
  "pluginspage", "http://www.adobe.com/go/getflashplayer"
 );
} else if (hasRequestedVersion) {
 // if we've detected an acceptable version
 // embed the Flash Content SWF when all tests are passed
 AC_FL_RunContent(
   "src", "${swf}",
   "width", "${width}",
   "height", "${height}",
   "align", "middle",
   "id", "${application}",
   "quality", "high",
   "bgcolor", "${bgcolor}",
   "name", "${application}",
   "allowScriptAccess","sameDomain",
   "type", "application/x-shockwave-flash",
   "pluginspage", "http://www.adobe.com/go/getflashplayer"
 );
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here. '
   + 'This content requires the Adobe Flash Player. '
    + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
// -->
</script>
<noscript>
   <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
   id="${application}" width="${width}" height="${height}"
   codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
   <param name="movie" value="${swf}.swf" />
   <param name="quality" value="high" />
   <param name="bgcolor" value="${bgcolor}" />
   <param name="allowScriptAccess" value="sameDomain" />
   <embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}"
    width="${width}" height="${height}" name="${application}" align="middle"
    play="true"
    loop="false"
    quality="high"
    allowScriptAccess="sameDomain"
    type="application/x-shockwave-flash"
    pluginspage="http://www.adobe.com/go/getflashplayer">
   </embed>
 </object>
</noscript>
</body>
</html>
0 Kudos
Matildaobaseki
Deactivated User
Thanks Rob,

If I embed your code in my javascript will this set my marker to display location and at same time set streetview panorama to the same location of that marker.

check the code below and see if this :marker.setLatLng(event.latLng);
ExternalInterface.call( "setPanorama", event.latLng.lat(), event.latLng.lng() );.....................
is alright to be within the geocode function or not...


Thanks,
// Geocoding example
var geocoder:ClientGeocoder = new ClientGeocoder();
geocoder.addEventListener(
GeocodingEvent.GEOCODING_SUCCESS,
function(event:GeocodingEvent):void {
var placemarks:Array = event.response.placemarks;
if (placemarks.length > 0) {
map.setCenter(placemarks[0].point);
var marker:Marker = new Marker(placemarks[0].point);
marker.addEventListener(MapMouseEvent.CLICK, function (event:MapMouseEvent):void {
marker.openInfoWindow(new InfoWindowOptions({content: placemarks[0].address}));

This is the error....
marker.setLatLng(event.latLng);
ExternalInterface.call( "setPanorama", event.latLng.lat(), event.latLng.lng() );
});

map.addOverlay(marker);
}
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matilda,


    What is the error you are getting the the flex app I never got an error in the flex side.
0 Kudos
Matildaobaseki
Deactivated User
Hi Robert,

Thanks it works but one more thing, after doing the search, it displays the location using the marker and then I have to click on the marker to get me the streetview because I' m using this function...
marker.addEventListener(MapMouseEvent.CLICK, function (event:MapMouseEvent):void {...
marker.openInfoWindow(new InfoWindowOptions({content: placemarks[0].address}));
marker.setLatLng(event.latLng);
ExternalInterface.call( "setPanorama", event.latLng.lat(), event.latLng.lng() );

How can I avoid not having to click on the marker first, I quess it will always have to set streetview to read  the latlng of that location.
How can I modify my code to do the search get it to parse th latlng to the streetview location somehow and then displays the corresponding streetview location without having to click on the marker.

Many Thanks.....
0 Kudos
TonyCollins
Regular Contributor
So does anyone know if there are any legal issues in doing this?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tony,

    Well over a year or more ago there was some discussion on just that the legality of using Google and particularly Bird's eye view data (Pictometry) inside a flex site and the popular route was that as long as you opened this data in a separate window and clearly indicated the origin of that data that you were OK. Now just last week I tried to dig into this when Frank showed his version that had Google street view and Bird's Eye inside a flex popup window, but could not find anything concise on the issue from Pictomerty or Microsoft. So I am going to continue to play it safe and open only Google Street View in a completely separate browser window.
0 Kudos
TonyCollins
Regular Contributor
Tony,

    Well over a year or more ago there was some discussion on just that the legality of using Google and particularly Bird's eye view data (Pictometry) inside a flex site and the popular route was that as long as you opened this data in a separate window and clearly indicated the origin of that data that you were OK. Now just last week I tried to dig into this when Frank showed his version that had Google street view and Bird's Eye inside a flex popup window, but could not find anything concise on the issue from Pictomerty or Microsoft. So I am going to continue to play it safe and open only Google Street View in a completely separate browser window.



Ah thanks Robert, that's what I do here. I just saw the example up above and wondered if anything had changed but the opinion here is that we can't embed Google into our application for free just now.

I'll keep listening...
0 Kudos
Matildaobaseki
Deactivated User
Hi Robert,

still waiting for a reply, is there a possible answer to my above question.

Thanks,

Matilda
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matilda,

    Sorry I don't know the answer to that one. You would be better off posting this non ESRI related question to a Google Maps forum.
0 Kudos
Matildaobaseki
Deactivated User
Alright, I thought about that too. Thanks Robert...
0 Kudos