ArcGIS for Desktop - Tips for Experts

Egge-Jan Pollé


Suppose you have a dataset with national parks and you want to know in which municipalities those parks are located. The answer you are looking for should have approximately this form:
De Alde Feanen National Park is - in 2016 - located in the municipalities: Tytsjerksteradiel, Heerenveen, Leeuwarden, Smallingerland.

How do you do that? In this blog we show how you can answer this question in ArcGIS for Desktop with the Spatial Join geoprocessing tool and a bit of Python.


In the Spatial Join dialog box, start by filling in the first two fields:

  • Target Features: national parks ← these are twenty polygons, including a few multipolygons
  • Join Features: municipalities2016 ← including water; handy! The Oosterschelde National Park consists mainly of water

Then specify the name and location for the Output Feature Class — for example, 'nationaleparken_sj' — and ensure that the Join Operation remains at the default value - JOIN_ONE_TO_ONE -. After all, you want to get every national park polygon only once and not several times (therefore, not a separate polygon for every overlapping municipality).


And how do you ensure that several municipal names are linked to a national park?
In the Field Map of Join Features section, right click on the Municipality Name column to open the Output Field Properties dialog box.

  • In this dialog, start by adjusting the Length of the column, from 30 to, for example, 400 characters. Why? If the column is too narrow, the consecutive municipality names will not fit in and your analysis will get stuck on an ERROR 001156 ...
  • Then set the Merge Rule to Join and the Delimiter, the separator, a comma and a space. (No, that space is not visible in the screenshot, but it is there.)


Click OK and view the Municipality Name column in the result table:


And to write this result in twenty beautiful sentences you can execute the following code in the Python screen:
with arcpy.da.SearchCursor("nationaleparken_sj",["naam","Gemeentenaam"]) as cursor:
 for row in cursor:
  print("The national park {0} is located in the municipalities in 2016: {1}.".format(row[0], row[1]))

Give it a try.


Do you want to know more about this topic?

Schedule an appointment with one of our experts today!

About us

Tensing makes Data Integration technology and Geographic Information Systems (GIS) accessible and applicable. Our consultants realize state-of-the-art solutions based on Esri ArcGIS and Safe Software FME.

With Esri we make maps, stimulate cooperation and analyze data. With FME we connect applications, transform data and automate workflows.

Follow us on LinkedIn

Receive our updates

© 2022 Tensing | Privacy Policy | Cookie Policy