Je possède un fichier avec de nombreuses entrées contenant des coordonnées GPS décimales avec 3 colonnes X, Y, ALT (=altitude en m).
X Y ALT
1 -79.55728 -3.092414 1921
2 -79.49925 -3.979880 2075
3 -79.46868 -4.079310 2043
...
J'ai converti ces données pour qu'elles correspondent au standart des fichier *.kml par les lignes de commandes suivantes :
coordinates(test)=~X+Y
proj4string(test) <- CRS("+proj=longlat +datum=WGS84")
DataTEST <- spTransform(test, CRS("+proj=utm +zone=19 +south +datum=WGS84"))
et j'obtiens :
x y z
1 -679763.0 9652277 1921
2 -672063.5 9552579 2075
3 -668467.4 9541447 2043
...
Je voudrais maintenant pouvoir obtenir à partir de ce fichier une matrice telle que présenter dans data(eberg_contour) afin de pouvoir utiliser correctement la fonction contour() et ainsi créer mes courbes de niveau vers GoogleEarth. Or :
"contour(Z) draws a contour plot of matrix Z, where Z is interpreted as heights with respect to the x-y plane. Z must be at least a 2-by-2 matrix that contains at least two different values. The x values correspond to the column indices of Z and the y values correspond to the row indices of Z. The contour levels are chosen automatically"
Je suis complètement bloqué pour arriver à créer une matrice semblable à cela :
> class(eberg_contours)
[1] "SpatialLinesDataFrame"
View(eberg_contours)
ID Z
0 0 160
1 1 160
2 2 160
3 3 160
...
Quelqu'un a-t-il une solution ? Ou a-t-il tenté la manip décrite ici ? http://gsif.isric.org/doku.php/wiki:tutorial_plotkml. Merci d'avance