Skip to content
Prev 22462 / 29559 Next

inconsistent as.data.frame(SpatialPointsDF)

There is some logic: sp tries to track coordinate names when it can, but
if coordinates are set as a nameless matrix, as in the last example
below, it will choose names itself. coordnames() helps you discover how
the coordinates of a SpatialPointsDataFrame are called:
x y z
1 1 2 3
2 2 1 4
[1] "x" "y"
[1] "x" "y"
coordinates x y z
1      (1, 2) 1 2 3
2      (2, 1) 2 1 4
[1] "coords.x1" "coords.x2"


a bit of a semantic trap is this: if your coordinates are longitude and
latitude and carry these names, after you project the object with
rgdal::spTransform they're still called longitude and latitude, although
they are no longer understood as such. You can then solve this yourself by
after which
[1] "x" "y"
On 03/20/2015 05:01 PM, MacQueen, Don wrote: