[R-sig-Geo] Scaling the scale bar
Alexander Sommer
Alexander.Sommer at tu-dortmund.de
Thu Feb 27 12:18:21 CET 2014
Dear list members,
I have got the feeling, that I missed something substantial about /layout.scale.bar/.
For example (not a pretty one, but might clarify my point)
> URL <- "http://www.geodatenzentrum.de/auftrag1/archiv/vektor/vg250_ebenen/2012/vg250_2012-01-01.utm32s.shape.ebenen.zip"
> td <- tempdir()
> setwd(td)
> temp <- tempfile(fileext = ".zip")
> download.file(URL, temp)
> unzip(temp)
> dir_temp <- paste(tempdir(),
+ "\\vg250_0101.utm32s.shape.ebenen",
+ "\\vg250_ebenen",
+ sep = "")
>
> require(rgdal)
> States <- readOGR(dsn = dir_temp,
+ layer = "vg250_bld",
+ encoding = "UTF8")
> Scale <- list("SpatialPolygonsRescale",
+ layout.scale.bar(),
+ offset = c(mean(States at bbox[1, ]), mean(States at bbox[2, ])),
+ scale = 0.1 * mean(States at bbox),
+ fill = c("white", "black"))
>
> spplot(States, "GEN", sp.layout = Scale)
draws a map of Germany’s States. Now, I would like to change the scale bar, so that it shows a distance of 100 kilometers. How can I assure that the length of the scale bar on the map corresponds with 100 kilometers in reality? (It might be too obvious or some other reason I do not get it. It feels already like the dumbest question to myself. So, my apologies in advance.)
Cheers,
Alex
--
Alexander Sommer
Forschungsverbund Deutsches Jugendinstitut/Technische Universität Dortmund
More information about the R-sig-Geo
mailing list