Skip to content

Commit 7ae7de1

Browse files
Merge pull request #179 from bcgov/qa
Migrate Sept 4 temp-road-closures/extents to Prod
2 parents 9e06bc1 + 80fe530 commit 7ae7de1

File tree

49 files changed

+5116
-4012
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5116
-4012
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
config/key
33
etc
4+
temp

build/cache/GM_DangerousGoodsRoutes.geojson

Lines changed: 46 additions & 0 deletions
Large diffs are not rendered by default.

build/cache/GM_OverheadStructures.geojson

Lines changed: 1112 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"type": "FeatureCollection",
3+
"name": "GM_TermPermitPoints",
4+
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
5+
"features": [
6+
{ "type": "Feature", "properties": { "Location": "232 St \/ 72 Ave", "Note": "Note this existing roundabout may change as the Interchange is being replaced by MoTI as part of the Highway 1, 216 Street to 264 Street widening project.", "Status": "Existing", "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.58132, 49.13825, 0.0 ] } },
7+
{ "type": "Feature", "properties": { "Location": "232 St \/ 64 Ave", "Note": null, "Status": "Under Construction", "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.58166, 49.11893, 0.0 ] } },
8+
{ "type": "Feature", "properties": { "Location": "232 St \/ 56 Ave", "Note": null, "Status": "Existing", "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.58115, 49.10396, 0.0 ] } },
9+
{ "type": "Feature", "properties": { "Location": "216 St \/ 50 Ave", "Note": "only the north\/south through movements accommodate a heavy truck", "Status": "Existing", "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.62463, 49.09305, 0.0 ] } },
10+
{ "type": "Feature", "properties": { "Location": "216 St \/ 48 Ave \/ Old Yale Road", "Note": null, "Status": "Existing", "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.62474, 49.08942, 0.0 ] } },
11+
{ "type": "Feature", "properties": { "Location": "Glover Road \/ University Drive", "Note": null, "Status": "Existing", "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.60289, 49.14265, 0.0 ] } },
12+
{ "type": "Feature", "properties": { "Location": "201 St \/ 100A Ave", "Note": "Technically not a truck route, but the main access point into the Northwest Langley industrial area", "Status": null, "Description": "TOL Roundabout", "Municipality": "Langley Township" }, "geometry": { "type": "Point", "coordinates": [ -122.66431, 49.18459, 0.0 ] } }
13+
]
14+
}

build/cache/GM_TermPermitRoutes.geojson

Lines changed: 87 additions & 0 deletions
Large diffs are not rendered by default.

build/download-geojson.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
download () {
4+
# mkdir -p "layers/$3"
5+
local out="temp/geojson/$1.geojson"
6+
local url="https://trp.regionalroads.com/api/?data=$1&format=geojson&download=true"
7+
8+
echo
9+
echo "downloading $url"
10+
curl "$url" --progress-bar > $out
11+
# jq -c ".features |= [ .[] | if .properties | $2 then . else empty end ] | .name = \"$3\" $4" $1 | ogr2ogr "$out" /vsistdin/
12+
echo "wrote $out ( $( jq ".features|length" "$out" ) features )"
13+
}
14+
15+
mkdir -p temp/geojson
16+
17+
echo
18+
echo "Cleanup"
19+
rm -v temp/geojson/*
20+
21+
echo
22+
echo "Copying cached datasets"
23+
cp -v cache/* temp/geojson
24+
25+
download GM_Cardlock
26+
download GM_Covid19Relief
27+
download GM_DangerousGoodsRestrictions
28+
# download GM_DangerousGoodsRoutes
29+
download GM_DowntownVancouver
30+
download GM_IndustrialAreas
31+
download GM_InspectionStation
32+
download GM_MetroVancouverBoundary
33+
download GM_MRN
34+
download GM_OSOWRoutes
35+
# download GM_OverheadStructures
36+
download GM_PortofVancouverFacilities
37+
download GM_TemporaryRoadClosures
38+
download GM_TemporaryRoadClosuresExtent
39+
# download GM_TermPermitPoints
40+
# download GM_TermPermitRoutes
41+
download GM_TruckParking
42+
download GM_TruckRoutes

build/extract-layers.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/sh
2+
3+
filter () {
4+
echo
5+
mkdir -p "temp/layers/$3"
6+
local out="temp/layers/$3/$3.geojson"
7+
jq -c ".features |= [ .[] | if .properties | $2 then del( .id, .geometry_name, .properties.Shape_Length, .properties.Shape_Area ) else empty end ] | .name = \"$3\" | .features |= sort_by( .geometry.coordinates ) | del( .totalFeatures, .numberMatched, .numberReturned, .timeStamp ) $4" $1 | ogr2ogr "$out" /vsistdin/ -lco COORDINATE_PRECISION=5
8+
echo "$1 ( $( jq ".features|length" "$1" ) ) -> $out ( $( jq ".features|length" "$out" ) )"
9+
}
10+
11+
mkdir -p temp/layers
12+
13+
echo
14+
echo "Cleanup"
15+
rm -vfr temp/layers/*
16+
17+
filter temp/geojson/GM_MetroVancouverBoundary.geojson '.' metro-vancouver-boundary
18+
19+
filter temp/geojson/GM_IndustrialAreas.geojson '.' industrial-area
20+
21+
filter temp/geojson/GM_DowntownVancouver.geojson '.' downtown-vancouver
22+
23+
filter temp/geojson/GM_MRN.geojson '.' major-road-network
24+
25+
filter temp/geojson/GM_TruckRoutes.geojson '.ProvincialJurisdiction == 1' provincial-highway
26+
27+
filter temp/geojson/GM_TruckRoutes.geojson '.RouteType != "Designated Municipal Truck Route with Restrictions" and .AdvisoryType == "Restriction"' truck-advisories-restrictions
28+
filter temp/geojson/GM_TruckRoutes.geojson '.RouteType != "Designated Municipal Truck Route with Restrictions" and .AdvisoryType == "Truck Travel Warning"' truck-advisories-warning
29+
30+
filter temp/geojson/GM_TruckRoutes.geojson '.RouteType == "Designated Municipal Truck Route"' truck-routes-designated-municipal-truck-route
31+
filter temp/geojson/GM_TruckRoutes.geojson '.RouteType == "Designated Municipal Truck Route with Restrictions"' truck-routes-designated-municipal-truck-route-with-restrictions
32+
filter temp/geojson/GM_TruckRoutes.geojson '.RouteType == "Municipal Road with No Truck Travel Restriction" and .AdvisoryType == null' truck-routes-municipal-road-with-no-truck-travel-restriction
33+
filter temp/geojson/GM_TruckRoutes.geojson '.RouteType == "Federal Road with No Truck Travel Restrictions"' truck-routes-federal-road-with-no-truck-travel-restrictions
34+
35+
filter temp/geojson/GM_TruckParking.geojson '.' truck-parking
36+
37+
filter temp/geojson/GM_PortofVancouverFacilities.geojson '.' port-of-vancouver-facilities-terminals
38+
39+
filter temp/geojson/GM_OverheadStructures.geojson '.Posted_Limit != "Y" and ( .Structure_Type == "Advertisement Sign" or .Structure_Type == "Overhead Sign/Signal" or .Structure_Type == "Scale Sign" )' overhead-directional-signs
40+
filter temp/geojson/GM_OverheadStructures.geojson '.Posted_Limit != "Y" and .Structure_Type != "Advertisement Sign" and .Structure_Type != "Overhead Sign/Signal" and .Structure_Type != "Scale Sign"' overhead-structure-without-height-marker
41+
filter temp/geojson/GM_OverheadStructures.geojson '.Posted_Limit == "Y"' overhead-structure-with-height-marker
42+
43+
filter temp/geojson/GM_Cardlock.geojson '.' cardlock
44+
45+
filter temp/geojson/GM_InspectionStation.geojson '.' inspection-station
46+
47+
filter temp/geojson/GM_DangerousGoodsRoutes.geojson '.' dangerous-goods-routes
48+
49+
filter temp/geojson/GM_DangerousGoodsRestrictions.geojson '.' dangerous-goods-restrictions
50+
51+
filter temp/geojson/GM_OSOWRoutes.geojson '.HeightRestriction == "4.88"' oversize-overweight-truck-routes-oah-up-to-4-88-m
52+
filter temp/geojson/GM_OSOWRoutes.geojson '.WidthRestriction == "5.0"' oversize-overweight-truck-routes-oaw-up-to-5-m
53+
filter temp/geojson/GM_OSOWRoutes.geojson '.WeightRestriction == "80000"' oversize-overweight-truck-routes-gvw-up-to-80000-kg
54+
filter temp/geojson/GM_OSOWRoutes.geojson '.WeightRestriction == "85000"' oversize-overweight-truck-routes-gvw-up-to-85000-kg
55+
filter temp/geojson/GM_OSOWRoutes.geojson '.WeightRestriction == "125000"' oversize-overweight-truck-routes-gvw-up-to-125000-kg
56+
57+
# filter temp/geojson/GM_TermPermit_Points.geojson '.Description == "OAW > 3.2m restricted"' term-permit-oaw-over-3-2-m
58+
# filter temp/geojson/GM_TermPermit_Points.geojson '.Description == "OAW > 3.8m restricted"' term-permit-oaw-over-3-8-m
59+
# filter temp/geojson/GM_TermPermit_Points.geojson '.Description == "OS/OW Truck Restriction"' term-permit-os-ow-truck-restriction
60+
filter temp/geojson/GM_TermPermitPoints.geojson '.Description == "TOL Roundabout"' term-permit-roundabout
61+
62+
filter temp/geojson/GM_TermPermitRoutes.geojson '.TermPermitType == "Restricted Term Permit Route"' term-permit-restricted-route
63+
filter temp/geojson/GM_TermPermitRoutes.geojson '.TermPermitType == "Restriction"' term-permit-restriction
64+
filter temp/geojson/GM_TermPermitRoutes.geojson '.TermPermitType == "Term Permit Route"' term-permit-route
65+
66+
filter temp/geojson/GM_TemporaryRoadClosuresExtent.geojson '.Status == "Active"' temporary-road-closure-extent
67+
filter temp/geojson/GM_TemporaryRoadClosures.geojson '.Status == "Active"' temporary-road-closure
68+
69+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Cardlock"' covid19-relief-cardlock
70+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Food Truck"' covid19-relief-food-truck
71+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Hotel"' covid19-relief-hotel
72+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Inspection Station"' covid19-relief-inspection-station
73+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Portable Toilet"' covid19-relief-portable-toilet
74+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Rest Area"' covid19-relief-rest-area
75+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Temporary Truck Parking"' covid19-relief-temporary-truck-parking
76+
filter temp/geojson/GM_Covid19Relief.geojson '.Active and .AmenityType == "Tourist Centre"' covid19-relief-tourist-centre

build/normalize-layers.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
./normalize.sh ../layers/cardlock/cardlock.geojson
2+
./normalize.sh ../layers/covid19-relief-cardlock/covid19-relief-cardlock.geojson
3+
./normalize.sh ../layers/covid19-relief-food-truck/covid19-relief-food-truck.geojson
4+
./normalize.sh ../layers/covid19-relief-hotel/covid19-relief-hotel.geojson
5+
./normalize.sh ../layers/covid19-relief-inspection-station/covid19-relief-inspection-station.geojson
6+
./normalize.sh ../layers/covid19-relief-portable-toilet/covid19-relief-portable-toilet.geojson
7+
./normalize.sh ../layers/covid19-relief-rest-area/covid19-relief-rest-area.geojson
8+
./normalize.sh ../layers/covid19-relief-temporary-truck-parking/covid19-relief-temporary-truck-parking.geojson
9+
./normalize.sh ../layers/covid19-relief-tourist-centre/covid19-relief-tourist-centre.geojson
10+
./normalize.sh ../layers/dangerous-goods-restrictions/dangerous-goods-restrictions.geojson
11+
./normalize.sh ../layers/dangerous-goods-routes/dangerous-goods-routes.geojson
12+
./normalize.sh ../layers/downtown-vancouver/downtown-vancouver.geojson
13+
./normalize.sh ../layers/industrial-area/industrial-area.geojson
14+
./normalize.sh ../layers/inspection-station/inspection-station.geojson
15+
./normalize.sh ../layers/major-road-network/major-road-network.geojson
16+
./normalize.sh ../layers/metro-vancouver-boundary/metro-vancouver-boundary.geojson
17+
./normalize.sh ../layers/overhead-directional-signs/overhead-directional-signs.geojson
18+
./normalize.sh ../layers/overhead-structure-with-height-marker/overhead-structure-with-height-marker.geojson
19+
./normalize.sh ../layers/overhead-structure-without-height-marker/overhead-structure-without-height-marker.geojson
20+
./normalize.sh ../layers/oversize-overweight-truck-routes-gvw-up-to-80000-kg/oversize-overweight-truck-routes-gvw-up-to-80000-kg.geojson
21+
./normalize.sh ../layers/oversize-overweight-truck-routes-gvw-up-to-85000-kg/oversize-overweight-truck-routes-gvw-up-to-85000-kg.geojson
22+
./normalize.sh ../layers/oversize-overweight-truck-routes-gvw-up-to-125000-kg/oversize-overweight-truck-routes-gvw-up-to-125000-kg.geojson
23+
./normalize.sh ../layers/oversize-overweight-truck-routes-oah-up-to-4-88-m/oversize-overweight-truck-routes-oah-up-to-4-88-m.geojson
24+
./normalize.sh ../layers/oversize-overweight-truck-routes-oaw-up-to-5-m/oversize-overweight-truck-routes-oaw-up-to-5-m.geojson
25+
./normalize.sh ../layers/port-of-vancouver-facilities-terminals/port-of-vancouver-facilities-terminals.geojson
26+
./normalize.sh ../layers/provincial-highway/provincial-highway.geojson
27+
./normalize.sh ../layers/temporary-road-closure/temporary-road-closure.geojson
28+
./normalize.sh ../layers/temporary-road-closure-extent/temporary-road-closure-extent.geojson
29+
./normalize.sh ../layers/term-permit-restricted-route/term-permit-restricted-route.geojson
30+
./normalize.sh ../layers/term-permit-restriction/term-permit-restriction.geojson
31+
./normalize.sh ../layers/term-permit-roundabout/term-permit-roundabout.geojson
32+
./normalize.sh ../layers/term-permit-route/term-permit-route.geojson
33+
./normalize.sh ../layers/truck-advisories-restrictions/truck-advisories-restrictions.geojson
34+
./normalize.sh ../layers/truck-advisories-warning/truck-advisories-warning.geojson
35+
./normalize.sh ../layers/truck-parking/truck-parking.geojson
36+
./normalize.sh ../layers/truck-routes-designated-municipal-truck-route/truck-routes-designated-municipal-truck-route.geojson
37+
./normalize.sh ../layers/truck-routes-designated-municipal-truck-route-with-restrictions/truck-routes-designated-municipal-truck-route-with-restrictions.geojson
38+
./normalize.sh ../layers/truck-routes-federal-road-with-no-truck-travel-restrictions/truck-routes-federal-road-with-no-truck-travel-restrictions.geojson
39+
./normalize.sh ../layers/truck-routes-municipal-road-with-no-truck-travel-restriction/truck-routes-municipal-road-with-no-truck-travel-restriction.geojson

build/normalize.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
echo
2+
rm "$1.old"
3+
mv -v $1 "$1.old"
4+
echo "$1.old ( $( jq ".features|length" "$1.old" ) features )"
5+
6+
jq -c ".features |= [ .[] | del( .id, .geometry_name, .properties.Shape_Length, .properties.Shape_Area ) ] | .features |= sort_by( .geometry.coordinates ) | del( .totalFeatures, .numberMatched, .numberReturned, .timeStamp )" "$1.old" | ogr2ogr "$1" /vsistdin/ -lco COORDINATE_PRECISION=5
7+
8+
echo "normalized $1 ( $( jq ".features|length" "$1" ) features )"
9+
rm "$1.old"

build/readme.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Instructions for updating the layer geo-data
2+
3+
## Prerequisites
4+
5+
The scripts are written in Bash, so will need a Unix-like system to run.
6+
Mac OS will work fine.
7+
Windows Subsystem for Linux (WSL) will also work.
8+
9+
To use these scripts, some additional tools are needed. All of these tools can be installed with homebrew (Mac), or apt (WSL):
10+
11+
- [cUrl](https://curl.haxx.se/)
12+
13+
- [jq](https://stedolan.github.io/jq/)
14+
15+
- [gdal](https://gdal.org/)
16+
17+
## Updating layers
18+
19+
Change to the `build` directory (directory where this readme is located):
20+
21+
> cd build
22+
23+
Download the latest versions of the source data:
24+
25+
> ./download-geojson.sh
26+
27+
Extract the layer files from the source data:
28+
29+
> ./extract-layers.sh
30+
31+
If everything looks ok, and no errors are reported, then update the layer files for the app:
32+
33+
> ./update-layers.sh
34+
35+
Now, look at the changes to the `layers` directory in your git client.
36+
Ensure that the changes are what you are expecting to be changed.
37+
Commit only changes that you are sure are actually necessary.
38+
39+
The directories `build/temp` and `build/etc` should be ignored by git, so don't commit any changes in those directories.
40+

build/update-layers.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
cd temp/layers
4+
find . -name '*geojson' -exec cp -v {} ../../../layers/{} \;

0 commit comments

Comments
 (0)