diff --git a/NetworkGenerator.R b/NetworkGenerator.R index 1d07c57..684ea1b 100644 --- a/NetworkGenerator.R +++ b/NetworkGenerator.R @@ -7,7 +7,7 @@ makeNetwork<-function(outputFileName="test"){ city = "Melbourne" # city = "Brisbane" # city = "Munich" - + # City parameters to be set # • outputCrs: desired coordinate system for network # • osmExtract: if 'processOsm=T', OSM extract file in .osm format (.osm.pbf @@ -24,7 +24,7 @@ makeNetwork<-function(outputFileName="test"){ # coordinate system as network) # • gtfs_feed: if 'addGtfs=T' or 'addDestinationLayer=T, zip file containing # GTFS data (and, if 'addGtfs=T', also set start and end dates in GTFS section) - + if (city == "Melbourne") { outputCrs = 28355 osmExtract = "./data/melbourne.osm" @@ -34,7 +34,7 @@ makeNetwork<-function(outputFileName="test"){ osmPbfExtract = "./data/melbourne_australia.osm.pbf" ndviFile = "./data/NDVI_1600mBuffer_Melbourne_reprojected.tif" gtfs_feed = "./data/gtfs.zip" - + } else if (city == "Brisbane") { outputCrs = 28356 osmExtract = "" # must set 'processOsm=F' @@ -54,7 +54,6 @@ makeNetwork<-function(outputFileName="test"){ osmPbfExtract = "./data/munich_germany.osm.pbf" ndviFile = "" # must set 'addNDVI=F' gtfs_feed = "./data/mvv_gtfs.zip" # to test; if not then >> # must set 'addGtfs=F' and 'addDestinationLayer=F' - } # INPUT NETWORK diff --git a/functions/addDestinations.R b/functions/addDestinations.R index bbe9d57..522c239 100644 --- a/functions/addDestinations.R +++ b/functions/addDestinations.R @@ -12,7 +12,7 @@ addDestinations <- function(nodes_current, city, gtfs_feed, outputCrs) { - + # nodes_current = networkDensified[[1]] # edges_current = networkDensified[[2]] # osmPbfExtract = "./data/melbourne_australia.osm.pbf" @@ -103,7 +103,7 @@ addDestinations <- function(nodes_current, # and store area and location details destination.pt <- bind_rows(destination.layer(points), - + # # add stations (from point, polygons and lines) to point table # getStation(points, polygons, lines) %>% # mutate(dest_type = "railway_station")) %>% @@ -127,6 +127,9 @@ addDestinations <- function(nodes_current, # Remove any invalid polygons as they may cause errors destination.poly <- destination.poly[which(st_is_valid(destination.poly$geometry)), ] + # Remove any invalid polygons as they may cause errors + destination.poly <- destination.poly[which(st_is_valid(destination.poly$geometry)), ] + # # check numbers of each destination type # chk <- full_join(destination.poly %>% # st_drop_geometry() %>% diff --git a/functions/addNDVI.R b/functions/addNDVI.R index c9f077f..b730c7e 100644 --- a/functions/addNDVI.R +++ b/functions/addNDVI.R @@ -41,7 +41,7 @@ addNDVI2Links <- function(links, ndviFile, ndviBuffDist) { mutate(row_no = row_number()) %>% left_join(., ndvi_values_mean, by = c("row_no" = "ID")) %>% dplyr::select(-row_no) - + # st_write(links.with.ndvi, "./SP_working/links_with_NDVI.sqlite", delete_layer = TRUE) return(links.with.ndvi) diff --git a/functions/getDestinationTypes.R b/functions/getDestinationTypes.R index 35b0278..9570e17 100644 --- a/functions/getDestinationTypes.R +++ b/functions/getDestinationTypes.R @@ -125,7 +125,6 @@ getCafe <- function(layer) { return(layer %>% filter(amenity == "cafe")) } - # 8 parking ---- getParking <- function(layer) { return(layer %>% filter(amenity == "parking" &