-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update readme documents for new data organisation and preparation
- Loading branch information
Showing
4 changed files
with
143 additions
and
100 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
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,37 +1,36 @@ | ||
# Update required | ||
# Network generation data | ||
|
||
The information below requires update, once final data location and structure is determined. | ||
This directory contains input files required to generate MATSim networks for Bendigo and Melbourne, which can be found [here](https://osf.io/ajycn/). | ||
|
||
# Network generation data | ||
## Files to download | ||
|
||
Download the following files for the relevant network location. | ||
|
||
### Bendigo | ||
| File | Description | | ||
|--------------------------|---------------------------------------------------| | ||
| greater_bendigo.sqlite | Boundary of the Greater Bendigo Local Government Area | | ||
| [to come] | Digital elevation model data for the Greater Bendigo area | | ||
| [to come] | [NDVI] data for the Greater Bendigo area | | ||
| gtfs.zip | GTFS feed for Victoria as at 20 October 2023 | | ||
|
||
|
||
### Melbourne | ||
| File | Description | | ||
|--------------------------|---------------------------------------------------| | ||
| greater_melbourne.sqlite | Boundary of the Greater Melbourne Greater Capital City Statistical Area | | ||
| [to come] | Digital elevation model data for the Greater Melbourne area | | ||
| [to come] | [NDVI] data for the Greater Melbourne area | | ||
| gtfs.zip | GTFS feed for Victoria as at 20 October 2023 | | ||
|
||
|
||
## Other files | ||
|
||
The directory also contains the following other files, from which the region boundary [and DEM] files above were created, using the code contained in `data/data prep tools.R`. That code may also be useful to generate similar data input files for other locations if required. | ||
|
||
| File | Description | | ||
|---------------------------------|--------------------------------------------| | ||
| LGAs.zip | Local government areas of Victoria (VICMAP) | | ||
| GCCSA_2021_AUST_SHP_GDA2020.zip | Greater capital city statistical areas (ABS) | | ||
| [to come] | Digital elevation model data for Victoria | | ||
|
||
This directory contains inputs files required to generate a MATSim network for Melbourne, which can be found [here](https://cloudstor.aarnet.edu.au/plus/s/ssLkX8Uez64rV3D). Alternatively, you can use the `./prepare.sh` command as described below to download the data you need. | ||
|
||
## How to populate | ||
|
||
To populate this directory with the required data files, use the `./prepare.sh` with the relevant arguments. Valid arguments and their descriptions are presented in the table below: | ||
|
||
| Argument | Input file | Description | | ||
|----------|------------------------------|-----------------------------------------------| | ||
| -region | studyRegion.sqlite | Greater Melbourne region | | ||
| -osm19 | melbourne.osm | Raw OSM file for Melbourne, 2019 | | ||
| -melb | melbourne.sqlite | Road attributes | | ||
| -net | network.sqlite | non-planar edges and nodes | | ||
| -gtfs19 | gtfs_au_vic_ptv_20191004.zip | GTFS feed - 2019-10-04 | | ||
| -demx10 | DEMx10EPSG28355.tif | Digital Elevation Model data (x10, EPSG28355) | | ||
| -A | all of the above | It Will download all the input files, (~1.2gb)| | ||
|
||
As an example, to start from processing raw OSM (step 1), and generating a network without elevation and public transport, you need to run the following to get the required input: | ||
``` | ||
./prepare.sh -osm19 | ||
``` | ||
|
||
Alternatively, if you want to skip processing raw OSM and start directly from `makeNetwork.sh`, and generate a network that has elevation and PT network from GTFS, you need to run the following to download required inputs: | ||
``` | ||
./prepare.sh -melb -net -gtfs19 -demx10 | ||
``` | ||
If you are not sure about which inputs are required, just simply run the following to download all the inputs: | ||
``` | ||
./prepare.sh -A | ||
``` | ||
|
||
If any issues with the script, please download each required file directly. |
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,97 @@ | ||
# Tools for creating input data files for use in NetworkGenerator | ||
# Currently these tools are applicable for Victoria only | ||
|
||
library(tidyverse) | ||
library(sf) | ||
library(terra) | ||
|
||
# 1 Region boundaries from LGA or GCCSA files ---- | ||
# -----------------------------------------------------------------------------# | ||
# function for extracting specific region from an administrative districts file | ||
getRegion <- function(input.file, input.field, input.name, | ||
output.filename, outputCrs) { | ||
|
||
input.transformed <- input.file %>% | ||
st_transform(outputCrs) | ||
|
||
output <- input.transformed %>% | ||
filter(.data[[input.field]] == input.name) | ||
|
||
st_write(output, paste0("./data/", output.filename, ".sqlite")) | ||
} | ||
|
||
# function to extract zipped shapefile | ||
# Note: 'subpath' is the string between the top zipped file and the ultimate file, eg "/gda2020_vicgrid/esrishape/whole_of_dataset/victoria/VMTRANS" | ||
# 'file' not needed for files that don't have layers (eg shapefiles) if there is only one in the directory | ||
# use 'file' (rather than 'layer') for shapefiles and mapinfo files; use both for gpkg and sqlite | ||
read_zipped_GIS <- function(zipfile, subpath = "", file = NULL, layer = NULL) { | ||
temp <- tempfile() | ||
unzip(zipfile, exdir = temp) | ||
if (is.null(layer)) { | ||
st_read(paste0(temp, subpath, file)) | ||
} else { | ||
st_read(paste0(temp, subpath, file), layer) | ||
} | ||
} | ||
|
||
# Greater Bendigo - from LGAs | ||
getRegion(input.file = read_zipped_GIS(zipfile = "./data/LGAs.zip", | ||
subpath = "/gda2020_vicgrid/esrishape/whole_of_dataset/victoria/VMADMIN"), | ||
input.field = "NAME", input.name = "GREATER BENDIGO", | ||
output.filename = "greater_bendigo", outputCrs = 7899) | ||
|
||
|
||
# Greater Melbourne - from GCCSA | ||
getRegion(input.file = read_zipped_GIS(zipfile = "./data/GCCSA_2021_AUST_SHP_GDA2020.zip"), | ||
input.field = "GCC_NAME21", input.name = "Greater Melbourne", | ||
output.filename = "greater_melbourne", outputCrs = 7899) | ||
|
||
|
||
|
||
# 2 Elevation from whole of state file ---- | ||
# -----------------------------------------------------------------------------# | ||
# function for extracting region's elevation from whole of state file | ||
getRegionDem <- function(dem.location, region.location, | ||
output.filename, outputCrs) { | ||
dem <- rast(dem.location) %>% | ||
project(., outputCrs) | ||
|
||
region <- st_read(region.location) | ||
|
||
dem.cropped <- terra::crop(x = dem, y = region %>% st_buffer(1)) | ||
|
||
writeRaster(dem.cropped, paste0("./data/", output.filename, ".tif"), | ||
gdal = "COMPRESS = DEFLATE", overwrite = TRUE) | ||
} | ||
|
||
# Bendigo | ||
getRegionDem(dem.location = "./data/vmelev_dem10m_ESRI_grid_GDA94_VicGrid/vmelev_dem10m_ESRI_grid_GDA94_Vicgrid/vmelev_dem10m/dem10m/hdr.adf", | ||
region.location = "./data/greater_bendigo.sqlite", | ||
output.filename = "DEM_bendigo", outputCrs = 7899) | ||
|
||
# Melbourne | ||
getRegionDem(dem.location = "./data/vmelev_dem10m_ESRI_grid_GDA94_VicGrid/vmelev_dem10m_ESRI_grid_GDA94_Vicgrid/vmelev_dem10m/dem10m/hdr.adf", | ||
region.location = "./data/greater_melbourne.sqlite", | ||
output.filename = "DEM_melbourne", outputCrs = 7899) | ||
|
||
|
||
|
||
# from other file | ||
dem <- rast("./data/vmelev_dem10m_ESRI_grid_GDA94_VicGrid/vmelev_dem10m_ESRI_grid_GDA94_Vicgrid/vmelev_dem10m/dem10m/hdr.adf") %>% | ||
# transform to project crs | ||
project(., "EPSG:28355") | ||
|
||
# load network | ||
network <- st_read("./data/melbourne_network_unconfigured.sqlite") | ||
|
||
# crop dem to network (will crop to bounding box) | ||
dem.network <- terra::crop(x = dem, y = network %>% st_buffer(1)) | ||
|
||
# save output | ||
writeRaster(dem.network, | ||
"./data/DEM_melbourne.tif", | ||
gdal = "COMPRESS = DEFLATE", | ||
overwrite = TRUE) | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.