I have a series of building represented as polygons. Surrounding these buildings I have multiple points with heights associated with them. What I am trying to do is identify all the points that are within 2 meters of each building and assign the maximum value from those points to the building polygon. The image below show what I am trying to achieve. I think I should be using spatial join, but not sure how to get the maximum values from a group of points.

enter image description here


This can be accomplished directly with the Spatial Join, though note you need to use the actual GP tool, not just right-click layer and choose joins.

Your parameters will be: target Features buildings, join features points, join operation one_to_one, set field mapping (see below), match_option within a distance of, search radius 2m

Field mapping is the key option. In that box you'll see a list of the fields that will be present in the output. One should be your value field from the points. Right-click it, choose Merge Rule, and select Maximum.

enter image description here

Because you are doing a spatial join, have chosen the one_to_one option (which means there can be only one match in the results), yet there are multiple points that will match each polygon, the Field Map lets you specify how this will be handled. It will look at all of the matching points (per the match option) and the output field will hold whatever modification of value you choose - it could sum them all, take the min/max, give you a count, etc.

| improve this answer | |

Spatial join your points to your polygons (by nearest) then use summary statistics to get the maximum value with a case field of the NEAR_FID. This will give you for every unique NEAR_FID (building) the maximum elevation.

Both of these tools are available at any license level. You may encounter situations where a point is 'near' two buildings, in this case the point will be allocated to the one that it is closest to, should this be a problem you will need to use Generate Near Table with all results and a maximum distance, this will give one row for each building within the search distance... unfortunately this awesome tool is limited to advanced license level.

If you don't have advanced license you can buffer the buildings then Intersect with the points to get multiple rows for each near building. On basic and standard the tool is limited to 2 inputs (that's fine).. intersect the buffers with the points and one row for each overlapping polygon will be produced. Then proceed to summary statistics.

| improve this answer | |
  • You can do this with just the spatial join - no other tools required. Also, your middle paragraph is correct, but only for the nearest method. A join feature can be matched to multiple target features; a point in range of two buildings will be considered for both. But of course nearest means -est so it only returns one result. As you correctly point out, that could be a problem if the highest value matches two buildings and is a risk with that match_option. cc @tsvgis – Chris W Jul 18 '15 at 0:11
  • Thanks @ChrisW, I forgot about multiple join capacity of spatial join. That would be preferable as it can be done at any license level. So then what's the point of Near and Generate Near Table? The buffer and intersect will also work at any license level which could be a handy approach if you need to subset the operation or if Spatial Join takes a very long time. – Michael Stimson Jul 18 '15 at 0:17
  • 1
    Spatial Join can't give you angles and near X/Y; at most you can get distance from it. Near is of course limited to nearest, where GNT isn't. GNT gives you further options for a closest count (regardless of distance - ie find the nearest 7 points), or using a radius. There's some subtle differences, but in a lot of cases a Spatial Join can get you what you need if you don't have that Advanced license. – Chris W Jul 18 '15 at 0:24

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.