Skip to main content
Question

Copy attributevalue


Forum|alt.badge.img
I have 2 shapefiles (points). How can i copy the attributevalue from shape 1 to shape 2 if the points have the same geometry.

 

Example if point A from shape 1 and point B from shape 2 have the same X,Y and i want to copy an attributevalue from point B point A

davideagle
Contributor
Forum|alt.badge.img+19
Easiet method is to use the UnconditionalFeatureMerger. However, you could concatenate the X&Y values into a new attribute called ID on both features and then use the FeatureMerger with the ID value as the new primary key.

 

 

Hope that helps

sigtill
Contributor
Forum|alt.badge.img+24
  • Contributor
  • March 6, 2013
Or use the AttributeCreator directly to get the X and Y value and then merge on the ID.

david_r
Evangelist
Just to add to the excellent answers below: if you're merging based on coordinate values it might be a good idea to add a CoordinateRounder or AttributeRounder on your values before merging.

 

 

Otherwise you risk missing matches based on fractional differences in the floating point string representation, e.g.

 

 

1.9999999997 <> 2.0

 

David

david_r
Evangelist
By the way, if you need to set a tolerance on your X,Y matching, use a NeigborFinder.

 

 

It enables you to specify a maximum distance (tolerance) between the two datasets and it will automatically merge the attributes on the matching geometries.

 

 

David

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings