2

I would like to lay an image over my map using the ArcGIS JS API. Whether it be a png, jpg, or gif, I'd like to be able to use a locally hosted image, give the 4 coordinates for the corners, and have that laid over my map. I know this is super simple to do in leaflet with an L.ImageOverlay or L.VideoOverlay, but I am struggling to see any documentation or examples that can do this with the ArcGIS JS API. I thought perhaps it could be done with a GraphicsLayer, but I don't see any examples. Frankly I'm not even sure where to get started with this. Is anyone familiar with how to do this?

1 Answer 1

1

In the v3 of the ArcGIS API for JavaScript, you can do this with a MapImageLayer, like this:

var mapImageLayer = new MapImageLayer();

var img = new MapImage({
  href: myImageUrl,
  extent: {
    // replace the values here:
    xmin: 22.222,
    ymin: 40.444,
    xmax: 79.999,
    ymax: 50.555,
    spatialReference: {
      wkid: 4326
    }
  }
});

mapImageLayer.addImage(img);

map.addLayer(mapImageLayer);

As of 2021-09, this same functionality is not yet supported in the latest v4 of the ArcGIS API for JavaScript.

1
  • 1
    Wow thanks for answering almost a year later. I probably should have specified in the question that I needed this functionality for v4. But the project I was working on is done now and I gave up on that feature, because, as you mentioned, its not supported in v4. Thanks! Sep 29, 2021 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.