How to get list of layers in a particular extent?

796
9
05-10-2018 10:20 PM
VijitWadhwa
New Contributor III

My requirement is , that if I search for a particular location on Map , then i should get all the layers that fall in that location , and on selecting on of those layers , that layer should be added to Map. Can anyone provide me with an Idea , how to do that please. Thanks in advance Antti KajanusMichael BranscombAnil KumarMorten NielsenJoe HershmanMara StoicaNagma Yasmin

0 Kudos
9 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

To calculate layers within a specific view extent, you could maintain a collection of layer extents and on the view navigation completed event use geometry engine to calculate the intersection of the full extents with the current view extent. Note to determine the layers that are visible at the specific view scale you can use the layer content interface property IsVisibleAtScale.

Here are some links to API reference that will get you started and in several cases there are samples within the API reference or links to additional examples. 

Layer.FullExtent Property 

GeoView.NavigationCompleted Event 

GeometryEngine Methods 

ILayerContent.IsVisibleAtScale Method 

I also recommend taking a look at the TableOfContents control in the toolkit: arcgis-toolkit-dotnet/src/Esri.ArcGISRuntime.Toolkit/WPF/UI/Controls/TableOfContents at master · Esr... 

Cheers

Mike 

VijitWadhwa
New Contributor III

Hi Mike,

Thanks for your help, this approach would be beneficial if layers are already a part of Map, What should be done if layers(geotiff images or geodatabase) are to be brought dynamically depending on some search criteria. For example " I Search for New Delhi in world map, then all the layers which are not yet part of the map , but are in the same extent should be shown and then user should have the provision to add whichever layer he wants ? " How should this be implemented in a complete offline environment , i.e offline data to be catalogued and brought on basis of some search criteria. Will the local server be helpful in this , if yes then how ?? Or what other approach should be used ??

Thanks in advance

0 Kudos
VijitWadhwa
New Contributor III

Hi Mike,

Thanks for your help, this approach would be beneficial if layers are already a part of Map, What should be done if layers(geotiff images or geodatabase) are to be brought dynamically depending on some search criteria. For example " I Search for New Delhi in world map, then all the layers which are not yet part of the map , but are in the same extent should be shown and then user should have the provision to add whichever layer he wants ? " How should this be implemented in a complete offline environment , i.e offline data to be catalogued and brought on basis of some search criteria. Will the local server be helpful in this , if yes then how ?? Or what other approach should be used ?? Please throw some light on this.

Thanks in advance 

0 Kudos
dotMorten_esri
Esri Frequent Contributor

Where are you searching though? Are you searching the ArcGIS Portal for data? Any data not loaded locally you'd have to somehow load first and inspect their extents. There's not really any way for the runtime to "magically" know what data you have where.

0 Kudos
VijitWadhwa
New Contributor III

Hi ,

Sir I want to query on the map ,I mean to say , is there any way to

catalogue data , for offline workflow ?

0 Kudos
dotMorten_esri
Esri Frequent Contributor

The runtime provides no cataloguing support. That would be for you to build. All the runtime can provide you here is what is the current extent of the map, or allow you to draw a search-box on the map, and you can then use that to search your own catalogue.

0 Kudos
VijitWadhwa
New Contributor III

Sir ,

How to build our own catalogue ? i.e for offline data ? Could u please

throw some light . .a small idea will also help. .

0 Kudos
AnttiKajanus1
Regular Contributor II

I think that what you are after there is to search files from your file system that you want to use. For example, if you use tile caches then look for .tpk files. Then in runtime side, you can open it up using TileCache Class and investigate TileCache.FullExtent Property to see if it's in the area that you are looking into. Follow similar pattern for the other data types.

0 Kudos
dotMorten_esri
Esri Frequent Contributor

Sorry we don't provide any sort of cataloguing APIs in runtime, so that's more of general question for how to create data catalogues that are outside the scope of this forum. We can help you with how to get metadata for a specific dataset, but you'd have to first find that data somehow and identify that file format it is. There's just no way for the Runtime APIs to just know where all the data on a users machine is, or what that data is. That would be very specific to your users and your scenarios, so that's something you'd have to come up with yourself.

The only option we provide in this regard is the ArcGIS Online Portal where you can upload, manage, share and query datasets. We have no such product for local, which is no different than for instance Microsoft Word doesn't provide a way to catalogue all your word documents - that's really some user manages in their own folders and chooses to browse to. Similarly you could build an experience for users to browse to data and add it to some sort of list your app manages with a local textfile, database, xml file or whatever format you want to use in your app.

0 Kudos