Skip to content

Commit

Permalink
Merge pull request #481 from nptscot/add_date_pmtiles
Browse files Browse the repository at this point in the history
add Simplified network tiling and add date to CN pmtiles's names
  • Loading branch information
wangzhao0217 authored May 21, 2024
2 parents b78ba9e + 5393896 commit f420b5f
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions code/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ for (region in region_names) {
grouped_network = corenet::coherent_network_group(cohesive_network_city_boundary, key_attribute = "all_fastest_bicycle_go_dutch")

# Use city name in the filename
corenet::create_coherent_network_PMtiles(folder_path = folder_path, city_filename = city_filename, cohesive_network = grouped_network)
corenet::create_coherent_network_PMtiles(folder_path = folder_path, city_filename = glue::glue("{city_filename}_{date_folder}"), cohesive_network = grouped_network)

message("Coherent network for: ", city, " generated successfully")
},
error = function(e) {
message(sprintf("An error occurred with %s: %s", city, e$message))
message(sprintf("An error occurred with %s: %s", city, e$message))
}
)
}
Expand Down Expand Up @@ -380,7 +380,7 @@ export_zone_json(zones_stats, "DataZone", path = "outputdata")
setwd("outputdata")
# Check the combined_network_tile.geojson file is there:
file.exists("combined_network_tile.geojson")
command_tippecanoe = paste("tippecanoe -o rnet_{date_folder}.pmtiles",
command_tippecanoe = glue::glue("tippecanoe -o rnet_{date_folder}.pmtiles",
"--name=rnet",
"--layer=rnet",
"--attribution=UniverstyofLeeds",
Expand All @@ -396,6 +396,26 @@ command_tippecanoe = paste("tippecanoe -o rnet_{date_folder}.pmtiles",

responce = system(command_tippecanoe, intern = TRUE)

# Simplified network tiling
setwd("outputdata")
# Check the combined_network_tile.geojson file is there:
file.exists("simplified_network.geojson")
command_tippecanoe = glue::glue("tippecanoe -o rnet_simplified_{date_folder}.pmtiles",
"--name=rnet_simplified",
"--layer=rnet_simplified",
"--attribution=UniverstyofLeeds",
"--minimum-zoom=6",
"--maximum-zoom=13",
"--drop-smallest-as-needed",
"--maximum-tile-bytes=5000000",
"--simplification=10",
"--buffer=5",
"--force simplified_network.geojson",
collapse = " "
)

responce = system(command_tippecanoe, intern = TRUE)

# Re-set working directory:
setwd("..")

Expand Down

0 comments on commit f420b5f

Please sign in to comment.