Extracting X and Y coordinates from dput data

Dear all;
I have tried "dput" function and I gave this output.

topo = readOGR("E:/New/..../Lake_Topo_1267_5.shp")#Read shape file
crs(topo) = "+proj=utm + zone=39 +datum=WGS84"

fil = tempfile()
dput(topo,"fil")
dget1 = dget("fil")
head(dget1,2)
An object of class "SpatialLinesDataFrame"
Slot "data":
FID_     Entity       Layer Color   Linetype Elevation LineWt RefName
0    0 LWPolyline C-TOPO-MAJR    84 Continuous      1258     25    <NA>
Slot "lines":
[[1]]
An object of class "Lines"
Slot "Lines":
[[1]]
An object of class "Line"
Slot "coords":
           [,1]    [,2]
  [1,] 519281.2 3955269
  [2,] 519281.2 3955269
.
.
.
.
.
[1678,] 519743.8 3956171
Slot "ID":
[1] "86"
Slot "bbox":
        min       max
x  518627.4  520133.8
y 3955054.7 3956343.2
Slot "proj4string":
CRS arguments:
 +proj=utm +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0 

dim(topo@data)

 87  8

The data frame of the "topo" has the exact number of row of the slot ID of dput (87 rows). Now I can see that the X and Y coordinates for each row. But there is a point, for each Elevation there are more than one XY coordinate. What I am trying to do is: putting Elevation for each ID of the dput data, e.g. for the ID number 1 that contains 30 (for example) rows of X and Y I want to add the first value of the Elevation column in topo data frame. After this I can create a 3 columns data frame with X, Y and Elevation in order to reading it into R and creating DEM.

Sincerely.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.