Assigning attributes from enclosing polygons to points

We had a question from a user who asked:

I want to assign attribute data from a polygon layer to a point layer.  If a point resides inside the polygon it is assigned attributes from the polygon.   In ArcMap this was called `Assign data by location' or something like that.  Can I do that with Cartographica?

 

We're beefing up our geospatial join capabilities for the next release, but for the time being, you can do this by selecting the point layer and then choosing Tools > Add Distance To Nearest Feature… (I know, sounds strange, but bear with me). In the ensuing panel, you'll be required to name the distance field and choose any fields from the target layer to copy. So, choose your polygon layer as the target and put something in the distance field name, then select any attributes you want copied.

One big caveat is that if you have points that are not within any polygon, they will be assigned the attributes of the nearest polygon and you will need to find them by searching for distances greater than zero and clearing out the values if you desire that not to be the case.

The little caveat is that if you don't want the distance column, you'll have to delete it afterwards.

One additional note is that if you have a lot of distance >0 features and you just want to clean them up easily, you can create a column, change the type to be the same as the result column you're adding, and then set the formula to:

"" if(DISTANCE>0) else VALUE 

or

0.0 if (DISTANCE>0) else VALUE

replacing DISTANCE with your distance column, and VALUE with your value column. Use the first example for string values and the second for numeric.

Have more questions? Submit a request

Comments

Powered by Zendesk