[R-sig-Geo] How to change coordonnate in a vector spatiladataframe

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 18 12:14:33 CET 2015


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 at coords=cbind(ProfilProj[,1],ProfilProj[,2])
>
> or:
>
> Vecteur at 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 at 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.Bivand at nhh.no


More information about the R-sig-Geo mailing list