Select to view content in your preferred language

Is there a way to determine the ZIP codes in an existing boundary/polygon?

662
2
12-12-2023 07:41 AM
Labels (1)
AndrewJarvis
Occasional Contributor

I am working on an existing project that has polygons for boundaries on a map, but the source ZIP codes that were used to create the boundary are missing.  I have a ZIP code layer in the project.  Is there a way, besides zooming in on the map and labeling and writing down every ZIP code in the boundary, perhaps a function, that will allow me to list all of the intersecting ZIP codes?  Thanks for any ideas you might have!

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

What do you want the output to look like? Just a list of ZIPs?

This is easy enough to do with Arcade in Field Calculator.

var zips = FeatureSetByName($datastore, "ZIP_codes")

var xs_zips = Intersects($feature, zips)

var codes = []

for (var z in xs_zips) {
  Push(codes, z['zip_code'])
}

return Concatenate(codes, ', ')
- Josh Carlson
Kendall County GIS
AndrewJarvis
Occasional Contributor

Thanks so much Josh!  I used to code, and I've learned just enough Arcade to create custom labels, but I haven't had the need thus far to learn the syntax for functions although I can see what you're doing code-wise.  Since there aren't ZIP codes in the polygon layer, I'm trying to figure out how to reference the ZIP codes in your example.  (You were right, by the way, just looking for a set of ZIPs and the city name although I could write a query with the ZIP output to easily get the names after the fact.)

If you have the chance to clarify, that's great, but in any case, many thanks!

0 Kudos