We do this for some of our parcel maps, and we use a similar process to what @JohannesLindner describes. I'd like to add a couple of points to the topic:
If the landuse and parcel layers do not align perfectly, you will have situations in which:
- Multiple landuses exist for a parcel
- A tiny sliver of adjacent landuse is included in the intersection, and mistakenly returned by the First function
If landuse and parcels overlay 1:1, that is, each parcel has 1 and only 1 landuse value, then consider modifying the parcel geometry prior to intersecting. You can:
- Buffer the feature by a negative distance to back away from the parcel boundaries a bit.
Caveat: If the negative distance is too large, though, you will collapse to a null geometry and the intersection will return nothing. - Intersect based on the centroid of the feature.
Caveat: If the parcel has an irregular shape, the centroid may not fall within the feature itself, and your intersection will not be correct.
Of course, we can combine both approaches into one. A centroid-based intersection is simpler to perform, so we can default to that, resorting to the negative buffer if the input parcel shape is irregular.
// Landuse
var lu = FeatureSetByName($map, "LandUse", ["landuse_type"])
// Feature centroid
var c = Centroid($feature)
// Check if feature does not contain its own centroid
var irreg = !Contains($feature, c)
// If irregular shape, use negative buffer method
// Otherwise use centroid
if(irreg){
var shp = Buffer($feature, -10)
var xs = Intersects(shp, lu)
} else {
var xs = Intersects(c, lu)
}
// Check if intersecting features found, return first landuse value
if(Count(xs) > 0){
return First(xs)['landuse_type']
} else {
return 'No landuse features found'
}
Mind that this expression is only returning a single value. If you want a delimited string of multiple intersected values, let me know, as I have an expression for that as well.
- Josh Carlson
Kendall County GIS