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

5268
44
09-22-2010 12:59 AM
Matildaobaseki
New Contributor
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
GaryBushek
New Contributor III
Lee,
   What did you get working? I dont see any code attachments here to try out. Is this available elsewhere?

Thanks, Gary
0 Kudos
Matildaobaseki
New Contributor
Hi  Frank,

Thanks, please send this as a zip file so I could try the code myself. Others seem to have liked it.

Thanks......
0 Kudos
Matildaobaseki
New Contributor
Hi Josh,

could you attached a new copy of the googlestreetview, the zip you sent previously seem to be corrupt. I ' m unable to view download the files.


Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matilda and Josh,

   The issue with the zip file be corrupted is a known issue with Internet Explorer and this forum. The original zip is not actually corrupted you just have to use any browser other that IE to download it. My preference is Firefox.
0 Kudos
deleted-user-RjoC4IOGTpoH
New Contributor
Hi Frank,

Is your your dual view app working with 2.1?
Mind if I try it out?

Excellent work ...

Nestor.
0 Kudos
FrankRoberts
Occasional Contributor III
Thank you everyone for the intrest.  I have 4 people testing currently.  Once I get feedback from them I'll start a new thread or post out the zip file in the user samples.  I have the sample working in 2.1, after some reworking.  My next task is to finish up work on the hyperlink code, once that is done I'll do the same.

Sorry for hyjacking the thread Robert!
0 Kudos
Matildaobaseki
New Contributor
Hello Code Gurus....
Below im mxml code for gecoding Addresses, now embedding google streetview in my html. What I want to archieve is as the marker locates the postcode search or address search in my map, it then parse the latlon of the position maker to the streetview panorama and displays the streetview image of that search.   but obviously, I' M NOT ARCHIEVING THIS. HELP PLEASE.
  HERE IS THE CODE....  it displays the marker for the search but not the streetview
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:maps="com.google.maps.*" 
    width="100%" height="100%" layout="absolute" viewSourceURL="srcview/index.html">
<mx:Panel title="Google Maps Demo" width="100%" height="100%">
  <mx:VBox width="100%" height="55%">
   <mx:HBox width="100%" height="25">
    <mx:Label
     text="Enter address: "/>
    <mx:TextInput x="76" y="10"
      id="address"
     text="london"
    enter="doGeocode(event);" />
    <mx:Button
     id="submitButton" label="Search"
     click="doGeocode(event);"
     />
   </mx:HBox>
   <maps:Map 
    id="map" 
    key="ABQIAAAA6-wf-nBKy-SMBfMdxRjYqxRjBgYrW1knLEOdndkig2gkeE6wEhT7MqUe29V1DYC-8Dw_CYwZPhdzzw" 
    mapevent_mapready="onMapReady(event)"
    width="100%" height="100%"/>
  </mx:VBox>
</mx:Panel>
<mx:Script>
  <![CDATA[
   import com.google.maps.services.ClientGeocoderOptions;
   import com.google.maps.LatLng;
   import com.google.maps.Map;
   import com.google.maps.MapEvent;
   import com.google.maps.MapMouseEvent;
   import com.google.maps.MapType;
   import com.google.maps.services.ClientGeocoder;
   import com.google.maps.services.GeocodingEvent;
   import com.google.maps.overlays.Marker;
   import com.google.maps.overlays.MarkerOptions;
   import com.google.maps.InfoWindowOptions;
   import mx.controls.Alert;
   import com.google.maps.controls.ZoomControl;
  
 
   import com.google.maps.controls.MapTypeControl;
   import com.google.maps.controls.PositionControl;
  
  private function onMapReady(event:Event):void {
//this.map.setCenter(new LatLng(37.4419, -122.1419), 13, MapType.NORMAL_MAP_TYPE);
this.map.setCenter(new LatLng(51.522524, -0.110933), 13, MapType.NORMAL_MAP_TYPE);
   
    map.enableScrollWheelZoom();
    map.enableContinuousZoom();
    map.addControl(new ZoomControl());
   }
  
   private function doGeocode(event:Event):void {
    // 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);
      }
     });
    geocoder.addEventListener(
     GeocodingEvent.GEOCODING_FAILURE,
     function(event:GeocodingEvent):void {
      Alert.show("Geocoding failed");
      trace(event);
      trace(event.status);
     });
    geocoder.geocode(address.text);
   }
  ]]>
</mx:Script>
</mx:Application>
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matilda,

   Where is your javascript code for the ExternalInterface.call( "setPanorama", event.latLng.lat(), event.latLng.lng() );?
0 Kudos
JoshCalhoun1
New Contributor II
Frank,

I just tried loading your street viewer widget and it works fine with the Services from ESRI but when I loaded it into my own viewer none of the windows would show up flash or html (see attachment). When I zoomed out inside the Google Map window, I found that my location had been switched to somewhere in Africa. It was way off.

Does the spatial reference have anything to do with this? I know it did not matter when I used Robert Scheitlens SV widget but this is a lot different.  My map services are in TN State Plane NAD 83 (wkid 2274).

Your thoughts would be greatly appreciated.

thanks,
0 Kudos
Matildaobaseki
New Contributor
Hi Rob,

here is  of the Javascript for the streetview panorama.

<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="iframe/iframe.js" type="text/javascript"></script>
<script src="AC_OETags.js" language="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>

<script src="http://maps.google.com/maps?file=api&v=2.x&key=ABQIAAAA6-wf-nBKy-SMBfMdxRjYqxRjBgYrW1knLEOdndkig2gke..."   type="text/javascript"></script>
<script type="text/javascript">

var myPano;  
var panoClient;
var nextPanoId;


function initialize()
{
  var whiteHouse = new GLatLng(51.522524, -0.110933);

  var whiteHousePOV = {yaw:180,pitch:0};
 
  panoClient = new GStreetviewClient();     
 
  myPano = new GStreetviewPanorama(document.getElementById("pano"));
  myPano.setLocationAndPOV(whiteHouse, whiteHousePOV);
  GEvent.addListener(myPano, "error", handleNoFlash); 
  panoClient.getNearestPanorama(whiteHouse, showPanoData);
}


function showPanoData(panoData)
{
  if (panoData.code != 200) {
    GLog.write('showPanoData: Server rejected with code: ' + panoData.code);
    return;
  }
 
  myPano.setLocationAndPOV(panoData.location.latlng);
}

function handleNoFlash(errorCode)
{
  if (errorCode == 603) {
    alert("Error: Flash doesn't appear to be supported by your browser");
    return;
  }


function setPanorama( lat, lon )
{
panoClient.getNearestPanorama(new GLatLng(lat, lon), showPanoData);
}

</script>
</script>


</head>

<body scroll="no" onload="initialize()" onunload="GUnload()">

<table cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr><td width="100%" height="100%">
<script language="JavaScript" type="text/javascript">
<!--


Thanks,
Matilda
0 Kudos