Select to view content in your preferred language

MapImageLayerView2D image-fetch-error on window location replace

806
2
09-09-2022 11:17 AM
GregoryBologna
Frequent Contributor

I'm getting an error in the API that I cannot debug. I am using https://js.arcgis.com/4.24

The error below happens after calling window.location.replace( **to some page** ).
 
It looks like the API is trying to make a request to our GIS server to do an export.

 

Error to console happens 2 seconds after window.location.replace.

[esri.views.2d.layers.MapImageLayerView2D] l {name: 'mapimagelayer:image-fetch-error', details: {…}, message: 'Unable to load image: https://gis.manateepao…/services/Website/WebLayers/MapServer/export'}

Loaded scripts (VSCode)

GregoryBologna_0-1662747019343.png

 

0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor

I think you're on the right track, this probably happens because "window.location.replace" causes a new response to be fetched from the server where the MapImageLayer is hosted. Perhaps the "replace" removes the history of the image that was previously fetched already? So it needs to fetch it again? I'm not sure as I haven't used that method before.

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#fetchIm...

Does the new location not have access to the server where the MapImageLayer is hosted? Does the MapImageLayer display normally in the app before the "window.location.replace"? And what is the "window.location.replace" doing for the app?

0 Kudos
GregoryBologna
Frequent Contributor

I have two different views of the map. One view is specific to a data point that a user has searched; it shows all pertinent ArcGIS data for the point. The other view is a full screen map that is launched on a button click event from a different page. Basically a "map" button. With this view, the user can zoom +/- and pan and click where they want, see popup info, or go to the detailed version of the page.  The window.location.replace happens when the user exits this map view and needs to go back to the search page.

You can see it live here.

https://www.manateepao.gov/search

0 Kudos