[R-sig-Geo] Problem in EPSG 2154 => 102110

Hodgess, Erin HodgessE at uhd.edu
Tue Sep 22 16:44:18 CEST 2015


Hello!

I ran through your example, and brought the OGR file back into R via the readOGR function.

> xxx <- readOGR(dsn="C:\\ajeter",layer="toto")
OGR data source with driver: ESRI Shapefile
Source: "C:\ajeter", layer: "toto"
with 1 features
It has 2 fields
> str(xxx)
Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
  ..@ data       :'data.frame': 1 obs. of  2 variables:
  .. ..$ IDENT: num 1
  .. ..$ ncols: num 1000
  ..@ polygons   :List of 1
  .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
  .. .. .. ..@ Polygons :List of 1
  .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
  .. .. .. .. .. .. ..@ labpt  : num [1:2] 700500 6500500
  .. .. .. .. .. .. ..@ area   : num 1e+06
  .. .. .. .. .. .. ..@ hole   : logi FALSE
  .. .. .. .. .. .. ..@ ringDir: int 1
  .. .. .. .. .. .. ..@ coords : num [1:5, 1:2] 700000 700000 701000 701000 700000 ...
  .. .. .. ..@ plotOrder: int 1
  .. .. .. ..@ labpt    : num [1:2] 700500 6500500
  .. .. .. ..@ ID       : chr "0"
  .. .. .. ..@ area     : num 1e+06
  ..@ plotOrder  : int 1
  ..@ bbox       : num [1:2, 1:2] 700000 6500000 701000 6501000
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:2] "x" "y"
  .. .. ..$ : chr [1:2] "min" "max"
  ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
  .. .. ..@ projargs: chr "+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +units=m +no_defs"
>
If you put that big @projagrs into google.com, this is what you get:

Proj4js.defs["EPSG:2154"] = "+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";

Is that what you want, please?

Thanks,
Erin


________________________________
From: R-sig-Geo [r-sig-geo-bounces at r-project.org] on behalf of PONS Frederic - CEREMA/DTerMed/DREC/SRILH [Frederic.Pons at cerema.fr]
Sent: Tuesday, September 22, 2015 9:25 AM
To: r-sig-geo at r-project.org
Subject: [R-sig-Geo] Problem in EPSG 2154 => 102110

Dear R-users,

I have a problem when I create a spatialpolygondataframe

I want to have an EPSG 2154 but after the export the epsg is 102110.

It seems to be the "same" CRS but it is not what I want.

A small example to help me
Best regards

xlla=700000
ylla=6500000
ncolsa=1000
nrowsa=1000
cellsizea=1

tableau <- data.frame(IDENT = 1, ncols = 1000, row.names = 1)

crds <- cbind(x=c(xlla,xlla+ncolsa*cellsizea, xlla+ncolsa*cellsizea, xlla, xlla), y=c(ylla, ylla, ylla+nrowsa*cellsizea, ylla+nrowsa*cellsizea, ylla))

Pa <- Polygon (crds)
Psa <- Polygons (list ( Pa ), 1)
pola <- SpatialPolygons (list ( Psa ), proj4string=CRS("+init=epsg:2154"))
SPDFa <- SpatialPolygonsDataFrame(pola, tableau)

writeOGR(SPDFa, dsn="C:\\ajeter",layer="toto",driver="ESRI Shapefile",overwrite_layer=TRUE)

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
[cid:part1.04060105.02070900 at cerema.fr]
Centre d’études et d’expertise sur les risques, l’environnement, la mobilité et l’aménagement
www.cerema.fr<http://www.cerema.fr>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150922/39f891e9/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cerema.png
Type: image/png
Size: 6094 bytes
Desc: cerema.png
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20150922/39f891e9/attachment.png>


More information about the R-sig-Geo mailing list