[Biomod-commits] Importing georgraphical coordinates in R

Manuel Spínola mspinola10 at gmail.com
Sat Sep 11 15:20:42 CEST 2010


  Thank you very much Wilfried.
Best,

Manuel

On 11/09/2010 06:59 a.m., Wilfried Thuiller wrote:
> You have different way.
> Either your data are already in a shapefile with associated coordinate 
> files, or they are simply a txt files with coordinates and you know 
> the projection system
>
> 1- Use the rgdal package.
> library(rgdal)
> poly <- readOGR("path_to_the_right_folder", 
> layer="name_of_the_files_without_extension")
> summary(poly)
>
>
> 2- In a text file you import in R with the name 'plots'
> Let's say you use the WGS84 projections and the coordinates are in 
> columns X_WGS84 and Y_WGS84
> pointsWGS84 <- plots[,c("X_WGS84", "Y_WGS84")]
> colnames(pointsWGS84) <- c("x","y")
> coordinates(pointsWGS84) <- c("x", "y")
> ### stipulate to R what is the projection. Look at the help file for 
> proj4string
> proj4string(pointsWGS84) <- CRS("+proj=latlong +datum=WGS84") # WGS84 
> projection string
> head(pointsWGS84 at coords)
>
> #if you want to transform the coordinates in another projection 
> system. For instance here in Lambert for France II étendu.
> # first create the projection file:
>
> proj4NTFII <- "+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 
> +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +b=6356515 
> +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs"
> #EPSG Projection 27582 - NTF (Paris) / France II
>
>
> pointsNTFII <- *spTransform*(pointsWGS84, CRS(proj4NTFII))
> head(pointsNTFII at coords)
>
> You have most of the projection system here:
>
> http://www.remotesensing.org/geotiff/proj_list/
>
>
>
>
> Le 10 sept. 2010 à 22:36, Manuel Spínola a écrit :
>
>> Dear list members,
>>
>> How do I import data in geographical coordinates to R?
>>
>> ref1                       ref2
>> N10 41 08.7     W84 10 46.3
>> N10 41 06.8     W84 10 46.4
>> N10 41 06.4     W84 10 44.6
>> N10 41 05.6     W84 10 46.0
>>
>> Best,
>>
>> Manuel
>>
>> -- 
>> Manuel Spínola, Ph.D.
>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>> Universidad Nacional
>> Apartado 1350-3000
>> Heredia
>> COSTA RICA
>> mspinola at una.ac.cr <mailto:mspinola at una.ac.cr>
>> mspinola10 at gmail.com
>> Teléfono: (506) 2277-3598
>> Fax: (506) 2237-7036
>>
>> _______________________________________________
>> Biomod-commits mailing list
>> Biomod-commits at lists.r-forge.r-project.org
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/biomod-commits
>
> --------------------------
> Dr. Wilfried Thuiller
> Laboratoire d'Ecologie Alpine, UMR CNRS 5553
> Université Joseph Fourier
> BP53, 38041 Grenoble cedex 9, France
> tel: +33 (0)4 76 51 44 97
> fax: +33 (0)4 76 51 42 79
>
> Email: wilfried.thuiller at ujf-grenoble.fr 
> <mailto:wilfried.thuiller at ujf-grenoble.fr>
> Home page: http://www.will.chez-alice.fr <http://www.will.chez-alice.fr/>
> Website: http://www-leca.ujf-grenoble.fr/equipes/tde.htm
>
> FP6 European MACIS project: http://www.macis-project.net 
> <http://www.macis-project.net/>
> FP6 European EcoChange project: http://www.ecochange-project.eu 
> <http://www.ecochange-project.eu/>
>
>
>
>
>


-- 
Manuel Spínola, Ph.D.
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola at una.ac.cr
mspinola10 at gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/biomod-commits/attachments/20100911/50a2898b/attachment-0001.htm>


More information about the Biomod-commits mailing list