Skip to content
Prev 7611 / 29559 Next

get X and Y form point shapefile

Hello,

On Thu, Feb 11, 2010 at 9:17 AM, gianni lavaredo
<gianni.lavaredo at gmail.com> wrote:
I have no idea about any of ArcMap's functions, and I'm sure many on
this list do not know either. I'm guessing that you want to add new
columns to the data-attributes of the object - this can be done
directly like this.

Assuming that sp package is loaded, and that "X" and "Y" do not
already exist, or you don't mind replacing them:

sample.df$X <-  coordinates(sample.df)[,1]
sample.df$Y <-  coordinates(sample.df)[,2]

A SpatialPointsDataFrame has no connection to the original shp/shx/dbf
files - you would need to write this object out to get the same result
in a shapefile.

Cheers, Mike.
Message-ID: <522664f81002101433j7d045d5frb1b8329c2211bf42@mail.gmail.com>
In-Reply-To: <518dff331002101417u4210b0fal515b26a774b9f877@mail.gmail.com>