0

I have a map with a feature class containing airport locations and another feature class showing flight paths between airports. I would like to create a map on ArcGIS Online where when I click on a particular airport, only flight paths from that specific airport are shown. Is there a way of doing this in ArcGIS Online ideally without too much coding? This is a sample of the map in it's present state. I would like to only show the flight routes from specific airports when they are clicked, for example, if I click London, only show flight paths from London. I was having a look through the ArcGIS Online sample code but couldn't find anything with this kind of functionality.

enter image description here

1

What you're describing, while pretty straightforward, simply isn't possible in the standard AGOL Map Viewer. The web web doesn't have capabilities for inter-layer actions like that. In a custom web map built with the Arcgis JavaScript API, it would be simple, but probably involves more coding than you're looking for.

If you want an off-the-shelf option that can achieve this, you should try using ArcGIS Dashboards. In a dashboard, you can configure Layer Actions in your map. For instance, you can set one layer, your lines, to filter based on the values in another layer, your points. Note that this assumes your points and lines to have certain attributes in common.

Consider the following sample dataset. In it, I have Points, with the attribute name, and Lines, with the attributes from_name and to_name. It's not as elaborate as your dataset, but it will do for a demonstration.

Points and connecting lines

  1. Add you map to a dashboard. You can do this from a blank dashboard, or you can choose the dashboard as an option in the Share menu in the web map viewer.
  2. Configure the web map element.

configure web map

  1. Go to Layer Actions and add a Filter action to the Points layer. Specify that the Lines layer is the target.

add a layer action

  1. Match the name field from the points layer to the *from_name" field of the Lines layer.

filter action field selection

Now go to the map. A feature selection icon has appeared in the upper-left. By turning the selection tool on, you can click on a point to select it, and see the filter in action.

filtered lines

Success! Well, not quite. You may have noticed that we can only specify one field for filtering our lines, and we cannot do an either/or on two fields. Every point in my dataset links to point D, but because D is in the to_name field on several of these, they will get filtered out.

incorrectly filtered lines

A simple solution to this would be to copy the layer in the webmap, and have the second layer filter on the other field. Alternatively, the lines could be duplicated with the to/from names swapped. Neither is particularly elegant, but the first is certainly less work. Not knowing the structure of your data, I can't speak to your situation specifically.

There are other capabilities in the readymade Web Apps, and in Web App Builder, but the Dashboard's filter may be the closest to what you're looking for that does not require significant coding.

| improve this answer | |

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.