[R-sig-Geo] Problems With Cartography - Help

Thierry Onkelinx thierry.onkelinx at inbo.be
Wed May 10 10:25:37 CEST 2017


Dear Andres,

You'll need spTransform() to reproject the layer into WGS84

carto2012x <- unionSpatialPolygons(carto2012, IDs=carto2012$DPA_CANTON)
spTransform(carto2012x, CRS("+proj=longlat"))

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2017-05-10 10:17 GMT+02:00 Andrés Peralta <tirico85 at gmail.com>:

> Hi to everyone,
>
> I`m working with the second administrative level cartography from Ecuador
> (available in:
> http://www.ecuadorencifras.gob.ec//documentos/web-inec/
> Cartografia/2015/Clasificador_Geografico/2012/SHP.zip).
> The shape file is called nxcantones.shp. I`ve been having a lot of problems
> opening and working with this cartography in R; but i can open it in Q-GIS
> and ARCGIS without any problem (I have opened it in both programs and saved
> it again). As the cartography has various objects with the same ID -
> aparently the same areas but repeated; we had to run the following sintax
> in order to have one ID in each area:
>
> *carto2012 <- readOGR("CANTONES2012/2012CLEAN.shp", "2012CLEAN",
> stringsAsFactors=F) *
> *proj4string(carto2012) <- CRS("+proj=utm +zone=17 +south +datum=WGS84
> +units=m +no_defs")*
>
> *carto2012x <- unionSpatialPolygons(carto2012, IDs=carto2012$DPA_CANTON)*
> *proj4string(carto2012x) <- CRS("+proj=utm +zone=17 +south +datum=WGS84
> +units=m +no_defs")*
>
>
> *datos <- data.frame(ID=row.names(carto2012x), stringsAsFactors = F)*
> *row.names(datos) <- row.names(carto2012x)*
> *carto2012x2 <- SpatialPolygonsDataFrame(carto2012x, data=datos)*
>
> *carto2012 <- carto2012x2 *
>
> Either using the original (nxcantones) or the modified cartography
> (carto2012), I can plot the map in R, but I can´t plot it in R Leaflet. It
> just opens the base map. I seems as the projection is lost in the way or
> that the cartography has a problem.
>
> Any ideas?
>
> --
>
> *             Andrés Peralta*
>         Pre-doctoral Researcher
>      GREDS/EMCONET / ASPB
> <https://www.upf.edu/greds-emconet/en/>   <http://aspb.cat/>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list