On Fri, 10 Feb 2023, Marcelino de la Cruz Rot wrote:

It depends on what you mean by "overimpose".

Maybe this way?

# some spatial polygon

Please, in the spirit of the evolving r-spatial package ecosystem (maptools will retire during 2023):

library(sf)
R <- st_as_sf(affine(letterR, mat=diag(c(20,20))))
plot(R, border="blue")

See https://r-spatial.org/r/2022/12/14/evolution2.html, maybe https://rsbivand.github.io/csds_jan23/bivand_csds_ssg_230117.pdf and https://www.youtube.com/watch?v=TlpjIqTPMCA&list=PLzREt6r1NenmWEidssmLm-VO_YmAh4pq9&index=1

Roger

library(maptools)
R <- as(affine(letterR, mat=diag(c(20,20))), "SpatialPolygons")
plot(R, border="blue")

# "overimpose" grids A to C on R:
plot(C, border="green", add=T)
plot(B, border="red", add=T)
plot(A, add=T)

Cheers,
Marcelino



El 10/02/2023 a las 13:29, Manuel Spínola escribió:
 Thank you very much Marcelino.

 And how can overimpose those grids to a spatial polygon?

 Manuel

 On Fri, 10 Feb 2023 at 03:09 Marcelino de la Cruz Rot
 <marcelino.delac...@urjc.es> wrote:

     Dear Manuel,
     This is R. There is no "it is possible". Only "how" ;-).

     For example, with spatstat.geom,

     A <- tess(xgrid=seq(0,80, by=8),ygrid=seq(0,80, by=8))
     B <- tess(xgrid=seq(0,80, by=4),ygrid=seq(0,80, by=4))
     C <- tess(xgrid=seq(0,80, by=2),ygrid=seq(0,80, by=2))
     D <- tess(xgrid=seq(0,80, by=1),ygrid=seq(0,80, by=1))

     Cheers,
     Marcelino


     El 10/02/2023 a las 0:21, Manuel Spínola escribió:
    >  Dear list members,
    >
    >  Is it possible to generate a spatial nested grid in R?
    >
    >  For example, a grid of several 8km x 8km tiles, and within that
     grid, I
    >  want 4 tiles of 4km x 4km, and in each of those I want 4 tiles
     of 2km x
    >  2km, and in each of those I want 4 tiles of 1km x 1km.
    >
    >  Manuel
>
     --
     Marcelino de la Cruz Rot
     Coordinador funcional de Biología
     Depto. de Biología y Geología
     Física y Química Inorgánica
     Universidad Rey Juan Carlos
     Móstoles España

     _______________________________________________
     R-sig-Geo mailing list
     R-sig-Geo@r-project.org
     
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-geo&data=05%7C01%7CRoger.Bivand%40nhh.no%7C0b29de36aca54242ddf008db0b6ade31%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638116325854200214%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Ngv4yEcnP6JM4zq5rpVgzcYgRHAFwPPS8JRFhMaRA58%3D&reserved=0

 --
 *Manuel Spínola, Ph.D.*
 Instituto Internacional en Conservación y Manejo de Vida Silvestre
 Universidad Nacional
 Apartado 1350-3000
 Heredia
 COSTA RICA
 mspin...@una.cr <mailto:mspin...@una.ac.cr>
 mspinol...@gmail.com
 Teléfono: (506) 8706 - 4662
 Institutional website: ICOMVIS
 
<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.icomvis.una.ac.cr%2Findex.php%2Fmanuel&data=05%7C01%7CRoger.Bivand%40nhh.no%7C0b29de36aca54242ddf008db0b6ade31%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638116325854200214%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fCKSKsYuj7JXD5CbsQDKFUkeAVpqekVl%2BbTYM2dpuzU%3D&reserved=0>
 Blog sobre Ciencia de Datos:
 
https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmspinola-ciencia-de-datos.netlify.app%2F&data=05%7C01%7CRoger.Bivand%40nhh.no%7C0b29de36aca54242ddf008db0b6ade31%7C33a15b2f849941998d56f20b5aa91af2%7C0%7C0%7C638116325854200214%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cVcjfP2hgnbfK%2BZCrCGFi4HhnQjGEWtx8zeJ%2BjBZDtE%3D&reserved=0




--
Roger Bivand
Emeritus Professor
Department of Economics, Norwegian School of Economics,
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway.
e-mail: roger.biv...@nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to