Skip to main content
Question

Copy attributevalue

  • 6 March 2013
  • 4 replies
  • 10 views

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

4 replies

Badge +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
Userlevel 1
Badge +24
Or use the AttributeCreator directly to get the X and Y value and then merge on the ID.
Userlevel 5
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
Userlevel 5
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