-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
105 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
^\.travis\.yml$ | ||
^makefile$ | ||
^vignettes/makefile$ | ||
^README\.Rmd$ | ||
^README\.md$ | ||
^README\.html$ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ Title: Customisable Images of OpenStreetMap Data | |
Version: 0.1-1 | ||
Date: 2016-03-01 | ||
Authors@R: person("Mark", "Padgham", email = "[email protected]", role = c("aut", "cre")) | ||
Description: Produces customisable images of OpenStreetMap data. Extracts OpenStreetMap data for specified key-value pairs (e.g. key="building") using the overpass API. Different OSM objects can be plotted in different colours using the function \code{add.osm.objects}. The function \code{group_osm_objects} enables customised highlighting of selected regions using different graphical schemes designed to contrast with surrounding backgrounds. | ||
Description: Produces customisable images of OpenStreetMap data. Extracts OpenStreetMap data for specified key-value pairs (e.g. key="building") using the overpass API. Different OSM objects can be plotted in different colours using the function add_osm_objects(). The function group_osm_objects() enables customised highlighting of selected regions using different graphical schemes designed to contrast with surrounding backgrounds. | ||
Depends: R (>= 3.2.3) | ||
Imports: | ||
ggm, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: "Downloading Data" | ||
author: "Mark Padgham" | ||
date: "`r Sys.Date()`" | ||
#output: rmarkdown::pdf_document | ||
output: rmarkdown::html_vignette | ||
vignette: > | ||
%\VignetteIndexEntry{Downloading Data} | ||
%\VignetteEngine{knitr::rmarkdown} | ||
%\VignetteEncoding{UTF-8} | ||
--- | ||
|
||
```{r load, include=FALSE} | ||
setwd ("../..") | ||
library (devtools) | ||
load_all ("osmplotr") | ||
setwd ("./osmplotr/vignettes") | ||
``` | ||
|
||
This vignette demonstrates how the `london` data included with the `osmplotr` | ||
package were generated. First customise an `osm_structures` data frame. | ||
|
||
```{r} | ||
bbox <- c(-0.15,51.5,-0.1,51.52) | ||
structures <- c ('highway', 'highway', 'building', 'building', 'building', | ||
'amenity', 'grass', 'park', 'natural', 'tree') | ||
structs <- osm_structures (structures=structures, col_scheme='dark') | ||
structs$value [1] <- '!primary' | ||
structs$value [2] <- 'primary' | ||
structs$suffix [2] <- 'HP' | ||
structs$value [3] <- '!residential' | ||
structs$value [4] <- 'residential' | ||
structs$value [5] <- 'commercial' | ||
structs$suffix [3] <- 'BNR' | ||
structs$suffix [4] <- 'BR' | ||
structs$suffix [5] <- 'BC' | ||
``` | ||
|
||
Then download the corresponding data | ||
|
||
```{r, eval=FALSE} | ||
london <- list () | ||
for (i in 1:(nrow (structs) - 1)) | ||
{ | ||
dat <- extract_osm_objects (key=structs$key [i], value=structs$value [i], | ||
bbox=bbox) | ||
fname <- paste0 ('dat_', structs$suffix [i]) | ||
assign (fname, dat) | ||
london [[i]] <- get (fname) | ||
names (london)[i] <- fname | ||
rm (list=c(fname)) | ||
} | ||
``` | ||
|
||
And finally the additional data for specific buildings and highways | ||
|
||
```{r, eval=FALSE} | ||
extra_pairs <- c ('name', 'Royal.Festival.Hall') | ||
london$dat_RFH <- extract_osm_objects (key='building', extra_pairs=extra_pairs, | ||
bbox=bbox) | ||
extra_pairs <- list (c ('addr:street', 'Stamford.St'), | ||
c ('addr:housenumber', '150')) | ||
london$dat_ST <- extract_osm_objects (key='building', extra_pairs=extra_pairs, | ||
bbox=bbox) | ||
highways <- c ('Kingsway', 'Holborn', 'Farringdon.St', 'Strand', | ||
'Fleet.St', 'Aldwych') | ||
london$highways1 <- highways2polygon (highways=highways, bbox=bbox) | ||
highways <- c ('Queen.s.Walk', 'Blackfriars', 'Waterloo', 'The.Cut') | ||
london$highways2 <- highways2polygon (highways=highways, bbox=bbox) | ||
highways <- c ('Regent.St', 'Oxford.St', 'Shaftesbury') | ||
london$highways3 <- highways2polygon (highways=highways, bbox=bbox) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MAPFILE = making-maps | ||
DATFILE = downloading-data | ||
|
||
all: maps data | ||
|
||
maps: mapsmake mapsopen | ||
|
||
data: datamake dataopen | ||
|
||
mapsmake: $(MAPFILE).Rmd | ||
echo "rmarkdown::render('$(MAPFILE).Rmd',rmarkdown::md_document(variant='markdown_github'))" | R --no-save -q | ||
echo "rmarkdown::render('$(MAPFILE).Rmd',output_file='$(MAPFILE).html')" | R --no-save -q | ||
|
||
datamake: $(DATFILE).Rmd | ||
echo "rmarkdown::render('$(DATFILE).Rmd',rmarkdown::md_document(variant='markdown_github'))" | R --no-save -q | ||
echo "rmarkdown::render('$(DATFILE).Rmd',output_file='$(DATFILE).html')" | R --no-save -q | ||
|
||
mapsopen: $(MAPFILE).html | ||
xdg-open $(MAPFILE).html & | ||
|
||
dataopen: $(DATFILE).html | ||
xdg-open $(DATFILE).html & | ||
|
||
clean: | ||
rm -f *.png *.html |