问题
I'm extracting elevation data of a route from a Digital Elevation Model using
my.elev <- over(new.points, mygrid)
- new.points is a SpatialPoints object, with the coordinates (long/lat) of about 7000 points transformed in the CRS of mygrid
- mygrid is a SpatialGridDataFrame with more than 8 millions elements
(more info in my previous question)
Having several NA values in my.elev, I debugged my code and I found that almost all the points in new.points repeated more than one time (in my route few segments are crossed two times):
- the first occurrence has the corresponding my.elev value correct
- the second one has a NA value (or sometimes, a quite different value)
I can easily solve the problem eliminating the duplicated values in new.points, but I wonder why the over function doesn't return the same value for the same point.
来源:https://stackoverflow.com/questions/27060307/incorrect-values-returned-by-spover-function