Select to view content in your preferred language

How can I detect whether lat/long coordinates is inside of the AGSArcGISTiledLayer?

510
2
Jump to solution
07-28-2022 08:46 AM
MasakiHirano
New Contributor II

sample.png

Is there a way to know if an arbitrary latitude and longitude is within the red-filled area of the AGSArcGISTiledLayer?

Here is the sample code and layer data.
I am using GitLFS because the layer data is heavy.

https://github.com/studio-rookery/ArcGISSample

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Hi.

Image tiled layers are designed for efficient display and don't have any backing information built in.

A couple of thoughts…

Do you have access to the source data as feature data to query against?

Another option would be to export an image snapshot of the map view using exportImage(), and convert the lat/lon from an AGSPoint into a screen location using locationToScreen(), then read the pixel value of the image for the CGPoint you get back.

View solution in original post

2 Replies
Nicholas-Furness
Esri Regular Contributor

Hi.

Image tiled layers are designed for efficient display and don't have any backing information built in.

A couple of thoughts…

Do you have access to the source data as feature data to query against?

Another option would be to export an image snapshot of the map view using exportImage(), and convert the lat/lon from an AGSPoint into a screen location using locationToScreen(), then read the pixel value of the image for the CGPoint you get back.

MasakiHirano
New Contributor II

Sorry for the late reply.

I was able to implement it by:

1. Export map image with scrolling to specified coordinates.
2. Check if the color of the image is red.

Thank you!