On Wed, 18 Mar 2015, Edzer Pebesma wrote:



On 03/18/2015 11:31 AM, PONS Frederic - CEREMA/DTerMed/DREC/SRILH wrote:
Hi

I try to change some coordinate in a vector read by readOGR
Vecteur = readOGR(dsnlayer,layer=nomlayer)

After some calculation, I try this without success:
Vecteur[nbi,]@coords=cbind(ProfilProj[,1],ProfilProj[,2])

try:

Vecteur_b = Vecteur[nbi,]
Vecteur_b@coords=cbind(ProfilProj[,1],ProfilProj[,2])

or:

Vecteur@coords[nbi,]=cbind(ProfilProj[,1],ProfilProj[,2])

and remember to update the bbox slot as nothing is automatic when slots are modified directly.

I'm also unsure whether Vecteur is a SpatialPointsDataFrame, although it looks as though it may be.



The error is:
Erreur dans as.vector(data) :
  pas de méthode pour convertir automatiquement cette classe S4 en vecteur

Thanks and best regards
--
*Frédéric Pons *
*Expert hydraulique sur les inondations et aléas côtiers
**DREC/Service Risques Inondations Littoraux et Hydraulique **- Tél.:
(33)4 42 24 76 68 *
*Direction Territoriale Méditerranée
*
Centre d’études et d’expertise sur les risques, l’environnement, la
mobilité et l’aménagement
www.cerema.fr <http://www.cerema.fr>


_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo




--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: roger.biv...@nhh.no
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to