Skip to content
Prev 23716 / 29559 Next

Match polygon and dataframe IDs after raster::extract

On 19/11/15 14:37, Lo?c Dutrieux wrote:
If it does reshuffle and you didn't specify match.ID, it will warn you:
[,1] [,2]
a    1    3
b    2    4
a
b 2
a 3
coordinates a
a      (1, 3) 3
b      (2, 4) 2
Warning message:
In SpatialPointsDataFrame(pts, df) :
  forming a SpatialPointsDataFrame based on maching IDs, not on record
order. Use match.ID = FALSE to match on record order
coordinates a
b      (1, 3) 2
a      (2, 4) 3

Using match.ID = FALSE ensures the input order of coordinates and points
is kept.