[R-sig-Geo] spatstat - affine a window - enlarging (with same center)
marcelino.delacruz at upm.es
marcelino.delacruz at upm.es
Tue Nov 22 19:27:11 CET 2011
Hi Mathieu,
Maybe Adrian or Rolf would give a more informated answer, but in the mean
time, my opinion is that you should compute the centroid of the affined
window and apply a "counter"-shift equivalent to the shift that
experiments the affined window.
Here's my example with the letterR window (I don't have the
metropolitan France map at hand)
data (letterR)
ratio <- 2 # example "ratio"
letterRa <- affine(letterR, mat=matrix(c(ratio,0,0,ratio), ncol=2))
# centroids of the original and affined windows
cLR <- centroid.owin(letterR)
cLRa <- centroid.owin(letterRa)
# this is the "counter"-shift
LRshift <- c(cLR[[1]]-cLRa[[1]], cLR[[2]]-cLRa[[2]])
# shift the affined window
letterRas<-shift(letterRa, vec=LRshift)
# see the results
plot(letterRas)
plot(letterR, add=T)
points(centroid.owin(letterR))
points(centroid.owin(letterRas), cex=2)
HTH,
Marcelino
Con fecha 22/11/2011, "Mathieu Rajerison" <mathieu.rajerison at gmail.com>
escribió:
>Hi List,
>
>
>I'd like to visually compare two spatial objects of France contour
>
>I have the population in France, the population in the 10 first major
>cities and I want to enlarge France by a ratio defined by pop(10 major
>cities)/pop(france), sort of a world cartogramwith the transformation of
>one country.
>
>But I have problems using shear transformation.
>
>Here is the code for the moment:
>
>fr <- readOGR(".", "FRANCE_METRO")
>fr.win <- as(fr, "owin")
>
>pop.fr <- 65447374
>townpops <- sum(pop$population)
>ratio <- townpops / pop.fr
>
>## here is my problem...
>fr.aff <- affine(fr.win, mat=matrix(c(ratio,0,0,ratio), ncol=2));
>
>Any help would be greatly appreciated
>
>
>Mathieu
>
> [[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
More information about the R-sig-Geo
mailing list