ArcGIS for Desktop - Tips for Experts

Egge-Jan Pollé

Spatial Join: ADDING MULTIPLE ATTRIBUTE VALUES TO ONE COLUMN

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.

GemeentenEnNationaleParken

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).

FIELD MAP OF JOIN FEATURES

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.)

SpatialJoinAndOutputFieldProperties

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

ResultTable

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.

TAGS: ArcGIS, ESRI

Do you want to know more about this topic?

Schedule an appointment with one of our experts today!
Knowlegde Hub

Discover more about this subject

Geo-data for streamlining asset management process at PidpaArcGIS,ESRI,Utilities,SAP,utility network management,Geocortex

5 myths and 5 truths about the integration between BIM and GISArcGIS,ESRI,ArcGIS Pro,GIS,blog,BIM,insights

Highlights from the 2019 edition of the Esri Partner ConferenceArcGIS,ESRI

Faster processing of data that your mobile collectsArcGIS,GIS,blog,insights,Mobile data

Esri Geodatabase ReplicationArcGIS,ESRI,GIS

About us

Tensing makes GIS technology accessible and applicable. Our consultants help clients achieve state-of-the-art solutions based on Esri ArcGIS and Safe Software FME.

Stay informed

Esri ArcGIS

With Esri we make maps, stimulate cooperation and analyze data so that you always have insight into your current situation.

Safe Software FME

With FME you can easily connect hundreds of applications, transform your data in endless ways and automate your workflows.
© 2019 Tensing | Privacy Policy | Cookie Policy