How to overlay a png type picture on a 2D map

1579
15
Jump to solution
01-12-2023 08:04 PM
Lzy
by
New Contributor III

Hello,

I had some problems when trying to overlay an image on the map using x-max, x-min, y-max, y-min, I tried to use AGSImageOverlay class to achieve this function, but found that the image could not be zoomed in and out as the map zoomed. Later I tried to implement it using AGSKMLLayer class, it worked, but AGSKMLLayer was loaded on map.operationalLayers and I couldn't change the order in which it was stacked with other layers.

Is there a better way to do this?

0 Kudos
1 Solution

Accepted Solutions
Ting
by Esri Contributor
Esri Contributor

will the subsequent version implement this layer

This feature is currently a user priority on our board, so hopefully it will be implemented soon.

> when will the iOS SDK version be updated

When this feature is implemented (potentially in the format of supporting 2D ImageOverlay), it will be in our new 200.x version of ArcGIS Maps SDK for Swift. Stay tuned and keep an eye on this channel: https://community.esri.com/t5/swift-maps-sdk-questions/bd-p/swift-maps-sdk-questions 

Internal Ref: release-plan # 940

View solution in original post

15 Replies
Ting
by Esri Contributor
Esri Contributor

Unfortunately, AGSImageOverlay and AGSImageFrame currently only work on an AGSSceneView. If a 3D scene fits your usecase, I would recommend try that out.

Using AGSKMLGroundOverlay is an option. You should be able to change the order of the AGSKMLLayer's by changing their order in the map's operational layers. Can you share a repro in case you cannot change the order?

Another hacky option would be using AGSPictureMarkerSymbol. You can create a symbol with an image, then honor the reference scale on the map by setting scaleSymbols to true. However, that means all the images (symbols) you add can only be at the same scale, and some calculation on their positions is needed.

Finally, if it suits your usecase, you can also consider using AGSRasterLayer or AGSWMSLayer. A raster file typically comes with a georeference, and common formats such as GeoTIFF or raster datasets in JPG/PNG formats would probably fit your needs. WMS server can deliver image files similar to ArcGISMapImageLayer.

 

Back in 10.x we used to support AGSDynamicLayer, see this discussion. However that was dropped in 100.x Runtime SDK. I'll query our team to see if other ways are available.

 

Attached is a demo project that you can play with. Hope it helps. 🙂

0 Kudos
Lzy
by
New Contributor III

Thank you very much for your answer.

I tried but it doesn't seem to solve my problem, can I change the overlay order between KML and Graphic layers?

0 Kudos
Ting
by Esri Contributor
Esri Contributor

Unfortunately, we don't have a way to interweave the z orders of operational layers and (the graphics in the) graphics overlays, as they are 2 different kinds of "layers" (graphics overlays are for overlaying graphics on top of a map view, whereas the operational layers can be a variety of things - raster, tiles, features, map image, annotation, etc.).

0 Kudos
Lzy
by
New Contributor III

Thank you very much for your answer.

Will later versions add classes of overlay images? What I need now is that I need to overlay one more image on top of a GraphicOverlay graph, and the size of the image can scale as the graph scales. The graphic is a rectangle. I tried the suggestion you gave to use AGSPictureMarkerSymbol, but I don't know how to solve the scaling problem. If so, can you give me some advice on how to calculate the scaling factor?

Thank you so much!                

0 Kudos
Ting
by Esri Contributor
Esri Contributor

I don't recommend the AGSPictureMarkerSymbol path. Sounds like your usecase involves adjusting the order of these layers, so symbol hack isn't really useful as they always stay on the top.

Again, in 100.x Runtime we currently don't have a good way to simply add a jpg to the map view. Either construct a raster from your jpg, or use AGSKMLLayer if you can.

The problem though, is that there is no way to reorder/interweave graphics overlays in between the operational layers, because they are 2 different concepts as "overlays" to a map view. 😥

Can you describe your usecase more specifically, so that we can analyze it and see if it can be provided as a feature in a future release?

0 Kudos
Lzy
by
New Contributor III

I need a layer like a Kml layer that can overlay a picture on the map, picture type png. You can manipulate the display order of the layer, the picture can follow the map zoom to scale, will the subsequent version implement this layer, and if so, when will the IOS SDK version be updated.

 

Thank you.

0 Kudos
Ting
by Esri Contributor
Esri Contributor

will the subsequent version implement this layer

This feature is currently a user priority on our board, so hopefully it will be implemented soon.

> when will the iOS SDK version be updated

When this feature is implemented (potentially in the format of supporting 2D ImageOverlay), it will be in our new 200.x version of ArcGIS Maps SDK for Swift. Stay tuned and keep an eye on this channel: https://community.esri.com/t5/swift-maps-sdk-questions/bd-p/swift-maps-sdk-questions 

Internal Ref: release-plan # 940

Lzy
by
New Contributor III

Ok, thanks for the answer!

0 Kudos
Ting
by Esri Contributor
Esri Contributor

A minor update on this topic: in a recent meeting I realized that there is ongoing effort for the ArcGIS Online web map viewer to support overlay 2D media (not limited to static images) on a map, and Runtime/Maps SDK might follow suit, which results in the delay of shipping any 2D option as we want to keep products in sync.
In the meantime, 2D ImageOverlay is definitely on our plate that we might release later this year.

0 Kudos