Overlay MapImage in JavaScript API 4.14

1769
4
Jump to solution
01-24-2020 03:08 PM
MikeV
by
New Contributor II

I am trying to overlay my basemap with a .gif image using the JavaScript web API version 4.14. I'm using the following code to initialize my MapImage and then add it to a MapImageLayer. I then add the MapImageLayer to my map.

 // create an add the actual image
                var radarImage = new MapImage({
                    'extent': { 'xmin': -92.530, 'ymin': 27.361, 'xmax': -97.620, 'ymax': 31.575 },
                    'href': '/data/layers/weather/high_zoom_ve_layer_weather.gif',
                    'spatialReference': { 'wkid': 4326 }
                });
                
                weatherRadarLayer = new MapImageLayer();
                weatherRadarLayer.title = "Weather Radar Layer";

                weatherRadarLayer.addImage(radarImage);

                map.addLayer(weatherRadarLayer);

My code throws the following error:

Error: "scriptError: https://js.arcgis.com/4.14/esri/views/MapImage.js"
    q https://js.arcgis.com/4.14/:5
    c https://js.arcgis.com/4.14/:23
4.14:24:471
    <anonymous> https://js.arcgis.com/4.14/:24
    signal https://js.arcgis.com/4.14/:6
    p https://js.arcgis.com/4.14/:4
    signal https://js.arcgis.com/4.14/:6
    c https://js.arcgis.com/4.14/:23

What am I doing wrong and how can I overlay a .gif image on my map?

0 Kudos
1 Solution

Accepted Solutions
MikeV
by
New Contributor II

Luckily, since my "layer" is a weather radar image, I was able to use the Map Service here to accomplish what I need.

nowcoast/radar_meteo_imagery_nexrad_time (MapServer) 

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Mike,

   In the 4.x API The MapImageLayer class is used for ArcGISDynamicMapServiceLayers (the 3.x name for map service layers). The 4.x API does NOT have any support for adding georeferenced images to the map at this time.

Functionality matrix | ArcGIS API for JavaScript 4.14 

MapImageLayer - Coming soon   (not to be confused with the 4x MapImageLayer which is the 4x version of the 3x ArcGISDynamicMapServiceLayer)

MikeV
by
New Contributor II

Luckily, since my "layer" is a weather radar image, I was able to use the Map Service here to accomplish what I need.

nowcoast/radar_meteo_imagery_nexrad_time (MapServer) 

0 Kudos
Noah-Sager
Esri Regular Contributor

Mike, feel free to mark this question as answered, even if you provided the answer yourself.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi @MikeV ,

Just want to let you know we are adding support for this at 4.24. You can use MediaLayer (new at 4.24) to add static images or videos on your map. You can test it out using our next version as of today. Please check it out and if you have any questions or feedback please let me know. 

https://github.com/Esri/feedback-js-api-next/blob/master/CHANGELOG.md