Skip to content

How to change coordonnate in a vector spatiladataframe

4 messages · Edzer Pebesma, Roger Bivand, PONS Frederic - CEREMA/DTerMed/DREC/SRILH

#
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])

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

Thanks and best regards
#
On 03/18/2015 11:31 AM, PONS Frederic - CEREMA/DTerMed/DREC/SRILH wrote:
try:

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

or:

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

  
    
#
On Wed, 18 Mar 2015, Edzer Pebesma wrote:

            
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.

  
    
#
Thanks
Vecteur at coords[nbi,]=cbind(ProfilProj[,1],ProfilProj[,2]) is what I want
Fr?d?ric

Le 18/03/2015 12:14, "> Roger Bivand (par Internet, d?p?t 
r-sig-geo-bounces at r-project.org)" a ?crit :