Select to view content in your preferred language

Pass coordinates to reset center for google map iframe

962
1
09-05-2019 10:25 AM
by Anonymous User
Not applicable

Sorry. Just wondering if anyone had any suggestions on transferring data extracted from an arcgis rest service to an iframe that I am locally hosting:

I am not sure if the postmessage is being sent because there is no callback although I believe it is going through. The event listener I know is wrong and needs work.

ArcGIS API for JavaScript

Tags (2)
0 Kudos
1 Reply
VictorTey
Esri Contributor

Brandon Price‌, i don't have my working computer with me so its hard for me to get some sample code but basically there are a few options.

you can pass data via localstorage

you can alternatively also use javascript, see a old code example of my

var win = window.open(this.widgetPath + "StreetView.html","_blank",
                    "width=" + this.config.svWidth + ",height="+
                    this.config.svWidth+",TOP=0,LEFT=0");
                if(!win){
                    alert("Make sure your pop up is unblocked");
                    return;
                }
                win.onload = function() { 
                    var point =  new Point(evt.mapPoint.x,evt.mapPoint.y,me.map.spatialReference)
                    win.initialize(0,point.getLatitude(),point.getLongitude());
                    win.setPanoramaCallback(lang.hitch(me,callback)); 
                    win.setPositionCallback(lang.hitch(me,me.callbackPositionChange))
                    win.setClose(lang.hitch(me,me.closeThisWidget));
                };

in your iframe

 function initialize(heading,lat,lon) {
        var pegPoint= {lat: lat, lng: lon};
        
         panorama = new google.maps.StreetViewPanorama(
            document.getElementById('pano'), {
              position: pegPoint,
              pov: {
                heading: heading,
                pitch: 10
              }
            });

       
    
      }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos