How to add a local image/georeferenced image to a map in ArcGIS JS API 4.x?

2820
7
05-13-2020 06:01 AM
MatheusSereno
New Contributor II

Is it possible to add a local image not georeferenced and set the coordinates in which it has to be (long,lat)? The only examples found were in the documentation which accesses a url from an ArcGIS server that provides a service for an ImageServer and adds it to a layer. 

Thanks!

0 Kudos
7 Replies
HarishPalaniappan
New Contributor III

MapImage and MapImageLayer classes would help you do the required.

An example here - https://gis.stackexchange.com/questions/80644/how-to-add-png-image-with-esri-javascript-api-mapimage...

arcgis-api-js-4.12‌ arcgis-api-js-4.14‌ arcgis-api-js-4.15‌

0 Kudos
MatheusSereno
New Contributor II

Hi, Harish

Thanks for the answer. Unfortunately, the example given uses the method addImage from the MapImageLayer class which doesn't exist in version 4.x of the ArcGIS JS API. Also, in the example, he doesn't use a local image accessing the filesystem.

Regards,

Matheus

0 Kudos
HarishPalaniappan
New Contributor III

Matheus,

MapImageLayer exists under 4.15 - see here - and the previous link i gave was from 3.x - so it always existed.

Javascript / HTML cannot access local filesystem from browsers for security reasons. you should consider hosting the image somewhere and linking to it.

0 Kudos
MatheusSereno
New Contributor II

Harish, 

Thanks for the answer. The MapImageLayer class exists. However, the method addImage doesn't, and is the one used to add the MapImage to the MapImageLayer in the example given. No access to local filesystem. Got it, thanks!

Regards,

Matheus

MarcoSotoDev
New Contributor II

Hello Matheus,

I have the same problem, could  you find a solution to this? I've been looking for a way to do this the whole week, but no luck.

JeremySwagger
New Contributor II

PictureMarkerSymbol is one workaround you can use in 4x

There is a similar thread here: https://community.esri.com/t5/arcgis-api-for-javascript/overlay-georeferenced-image-with-arcgis-java... 

Working Examplehttps://codepen.io/Jswag/pen/poeZJoq 

Tags (1)
0 Kudos
JuliePowell
Esri Contributor

We are releasing the ability to overlay images and videos in 4.24 next week! You can try it out now using the /next early access release, and we are looking to get some feedback on it. The functionality is even better than 3.x… you can overlay both images and videos in 2D and 3D, add/remove multiple images on the fly very easily, and use it with other 4.x capabilities like layer blending (note: so far you can only do layer blending with MediaLayers in 2D). 

Here's a simple example: https://codepen.io/U_B_U/pen/MWQGWdb?editors=1000 

Drop me a note and let me know how you will be using it 🙂

0 Kudos