Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to use latest DataBC version of SMK while retaining previous development branch changes #289

Open
wants to merge 57 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d6c606e
Print better handles layers not visible (#230)
michaelpnelson Jun 6, 2022
6c08575
Add GDX Analytics script (#235)
michaelpnelson Jun 14, 2022
d6600d1
Remove -TLINK from Snowplow app ID
michaelpnelson Jun 15, 2022
2cce48e
Use ESRI vector basemap API and basemaps
michaelpnelson Jun 23, 2022
ecd3610
Change default basemap to Streets (#236)
michaelpnelson Jun 27, 2022
2a9bb45
Snowplow tracker collector update
michaelpnelson Jul 7, 2022
4b5c314
Esri API key added raw, ConfigMap config removed (#239)
michaelpnelson Jul 26, 2022
03dead5
Update object esriApiKey read from (#241)
michaelpnelson Jul 26, 2022
6a4bd5c
Remove ver parameter from geocoder URLs (#242)
michaelpnelson Aug 18, 2022
e52b2b6
update readme
qqnluaq Aug 25, 2022
a665aa7
iwp
qqnluaq Aug 26, 2022
13a8243
update layer style
Aug 26, 2022
026aafb
tlink-221 updating road styles
Aug 31, 2022
339cc7e
tlink-221 styling update
Aug 31, 2022
b4757ab
update readme
Sep 1, 2022
ed90b6b
Merge pull request #245 from qqnluaq/develop
qqnluaq Sep 1, 2022
60d0bf4
Update dockerfile URL
michaelpnelson Sep 6, 2022
0922c57
Another update to dockerfile URL
michaelpnelson Sep 12, 2022
e131a96
Add minZoom and maxZoom properties when initializing the leaflet map.
dgboss Sep 14, 2022
914acc3
Merge pull request #248 from bcgov/maxZoom
dgboss Sep 14, 2022
47946b7
tlink-246 Update to Overhead Structures data
qqnluaq Oct 11, 2022
c603387
Merge pull request #250 from bcgov/tlink-246
qqnluaq Oct 11, 2022
4ce82c2
tlink-246 update filtering for overhead signs
Nov 7, 2022
5573612
Merge pull request #251 from bcgov/tlink-246
qqnluaq Nov 7, 2022
18bdd9b
tlink-246 add heights to overhead directional sign identify
qqnluaq Nov 7, 2022
ecfb16a
Merge pull request #252 from bcgov/tlink-246
qqnluaq Nov 7, 2022
2c7b51e
Change default basemap to StamenTonerLight
michaelpnelson Nov 9, 2022
48eb558
Update contact email
michaelpnelson Nov 25, 2022
f86d264
tlink-221 fix major road network layer at high zoom
Jan 19, 2023
a7e7339
tlink-221 fix major road network layer at high zoom
Jan 19, 2023
294fcee
tlink-221 change legend rendering for line features
Jan 19, 2023
4166426
tlink-221 reload smk for patching, and preload layer configs for para…
Jan 20, 2023
6b21d38
tlink-221 move MRN layer under truck routes
qqnluaq Jan 20, 2023
15f42e2
tlink-221 parameterize styling of many layers
qqnluaq Jan 20, 2023
0c914e9
Merge pull request #262 from bcgov/tlink-221
qqnluaq Jan 20, 2023
41ba129
tlink-221 changed prov highway styling, adjusted layer order, and lin…
qqnluaq Feb 3, 2023
253d9dd
Merge pull request #263 from bcgov/tlink-221
qqnluaq Feb 3, 2023
0fc45e2
Merge remote-tracking branch 'origin/develop' into tlink-246
qqnluaq Mar 28, 2023
9bd51af
tlink-246 add heights to overhead-structure-without-height-marker
qqnluaq Mar 28, 2023
20a3a2d
Merge pull request #264 from bcgov/tlink-246
qqnluaq Mar 28, 2023
b385a57
Revert "Update object esriApiKey read from (#241)"
michaelpnelson May 19, 2023
6dc26a5
Revert "Esri API key added raw, ConfigMap config removed (#239)"
michaelpnelson May 19, 2023
78f449a
Revert "Change default basemap to Streets (#236)"
michaelpnelson May 19, 2023
58c01d7
Revert "Use ESRI vector basemap API and basemaps"
michaelpnelson May 19, 2023
f99721d
Nonfunctional change to trigger redeploy
michaelpnelson Feb 1, 2024
61b92d6
Initial Update to use bcgov/smk 1.2.1 rather than a local smk file, b…
CEBergin-Vivid Mar 20, 2024
df0e907
Merge branch 'develop_legacy' into feature/updateSMKToBCGovVersion
CEBergin-Vivid Mar 20, 2024
022d8cc
Switch basemap, change what SMK.MAP to use
CEBergin-Vivid Mar 22, 2024
da2f9a5
Remove line to disable 3D
CEBergin-Vivid Mar 22, 2024
327124f
Set default basemap to Imagery
CEBergin-Vivid Mar 22, 2024
50b4e3e
Seperate config for viewer section of map.json used for smk config in…
CEBergin-Vivid Mar 22, 2024
92be544
Use smk-tlink esri api key configured for this project
CEBergin-Vivid Mar 22, 2024
8abfd14
Move key back to map.json and index now that the esri api key will no…
CEBergin-Vivid Mar 25, 2024
0375802
Remove space
CEBergin-Vivid Mar 25, 2024
fee7719
Merge branch 'develop' into feature/updateSMKToBCGovVer
CEBergin-Vivid Mar 25, 2024
8caea8b
Ensure default base map is still Gray
CEBergin-Vivid Mar 25, 2024
88527b4
update all uses of smk.js to use node modules version
CEBergin-Vivid Mar 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ The Truck Route Planner application for Translink built using the Simple Map Kit

## Updated OCP4 Deployment Steps
Builds and Deployment Templates are provided in the Openshift Dir located in the root of this repo


## Testing locally

Add this entry to `/etc/hosts`:

127.0.0.1 translink-d.apps.gov.bc.ca

Install dependencies with `npm install`.
Start the app with `npm start`.

Access the app via: [Local](https://translink-d.apps.gov.bc.ca:7443/).
44 changes: 22 additions & 22 deletions config/layer-display.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
{
"type": "layers",
"display": [
{
"type": "folder",
"title": "Pre-screened Oversize-Overweight (OS-OW) Truck Routes",
"isVisible": false,
"items": [
{ "id": "oversize-overweight-truck-routes-gvw-up-to-80000-kg", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-gvw-up-to-85000-kg", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-gvw-up-to-125000-kg", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-oaw-up-to-5-m", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-oah-up-to-4-88-m", "class": "smk-inline-legend" }
]
},
{
"type": "group",
"title": "Major Road Network",
"isVisible": false,
"class": "smk-inline-legend",
"items": [
{ "id": "major-road-network-high-zoom" },
{ "id": "major-road-network" }
]
},
{
"type": "group",
"title": "Truck Routes",
Expand Down Expand Up @@ -49,18 +71,6 @@
{ "id": "temporary-road-closure" }
]
},
{
"type": "folder",
"title": "Pre-screened Oversize-Overweight (OS-OW) Truck Routes",
"isVisible": false,
"items": [
{ "id": "oversize-overweight-truck-routes-oah-up-to-4-88-m", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-oaw-up-to-5-m", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-gvw-up-to-80000-kg", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-gvw-up-to-85000-kg", "class": "smk-inline-legend" },
{ "id": "oversize-overweight-truck-routes-gvw-up-to-125000-kg", "class": "smk-inline-legend" }
]
},
{
"type": "folder",
"title": "Height Restrictions",
Expand All @@ -85,16 +95,6 @@
{ "id": "port-of-vancouver-facilities-terminals", "isVisible": false, "class": "smk-inline-legend" },
{ "id": "industrial-area", "isVisible": true, "class": "smk-inline-legend" },
{ "id": "downtown-vancouver", "isVisible": false, "class": "smk-inline-legend" },
{
"type": "group",
"title": "Major Road Network",
"isVisible": false,
"class": "smk-inline-legend",
"items": [
{ "id": "major-road-network-high-zoom" },
{ "id": "major-road-network" }
]
},
{
"type": "group",
"title": "Provincial Highway",
Expand Down
13 changes: 7 additions & 6 deletions config/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"viewer": {
"type": "leaflet",
"location": {
"extent": [
-123.5129561160918,
48.77200307901124,
-122.21397142118256,
49.72867079292322
]
"extent": [
-123.5129561160918,
48.77200307901124,
-122.21397142118256,
49.72867079292322
]
},
"baseMap": "Gray",
"esriApiKey": "AAPKacb4ff83a3e34b4887bed2d86c318279EXFibvw9GBGQCOMSQBVRdU3aaWqj6GrdbTKGtSxq6MXtukzb2O7CSwa_bv1iY3ia",
Expand Down Expand Up @@ -79,6 +79,7 @@
"Topographic",
"Streets",
"Imagery",
"StamenTonerLight",
"DarkGray",
"Gray"
],
Expand Down
232 changes: 182 additions & 50 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
<title>TRP - Translink</title>
<script src="./node_modules/@bcgov/smk/dist/smk.js"></script>
<link rel="stylesheet" type="text/css" href="lib/dialog-polyfill/dialog-polyfill.css"/>


<link rel="stylesheet" type="text/css" href="smk-trp.css"/>
<style>
body.hide article {
Expand Down Expand Up @@ -143,9 +141,9 @@

<script src="trp-vehicle-definitions.js"></script>
<script src="config/site/config.js"></script>
<script src="smk-overrides.js"></script>

<script>

( function () {
if ( SMK.FAILURE ) {
var dialog = document.getElementById( 'disclaimer' )
Expand All @@ -157,7 +155,7 @@
var dialog = document.getElementById( 'disclaimer' )
include( [ { url: './fragments/disclaimer.html' }, { url: './fragments/disclaimer.css' } ], 'disclaimer' ).then( function ( inc ) {
dialog.innerHTML = inc[ 'disclaimer.disclaimer-html' ]

dialog.showModal()
} )

Expand All @@ -171,7 +169,7 @@
} )

document.getElementById( 'logo' ).addEventListener( 'click', function () {
SMK.MAP[ 1 ].$tool[ 'bespoke--about' ].active = true
SMK.MAP[ 2 ].$tool[ 'bespoke--about' ].active = true
} )

SMK.HANDLER.set( 'bespoke--reports', 'initialized', function ( smk, tool ) {
Expand All @@ -184,51 +182,163 @@

var defaultVehicle = TRP.vehicleTypes[ 0 ].configs[ 0 ]

SMK.INIT( {
'smk-container-sel': "#smk-map-frame",
'smk-config': [].concat( [
'./layers/cardlock/config.json',
'./layers/dangerous-goods-restrictions/config.json',
'./layers/downtown-vancouver/config.json',
'./layers/industrial-area/config.json',
'./layers/inspection-station/config.json',
'./layers/major-road-network/config.json',
'./layers/metro-vancouver-boundary/config.json',
'./layers/overhead-directional-signs/config.json',
'./layers/overhead-structure-with-height-marker/config.json',
'./layers/overhead-structure-without-height-marker/config.json',
'./layers/oversize-overweight-truck-routes-oah-up-to-4-88-m/config.json',
'./layers/oversize-overweight-truck-routes-oaw-up-to-5-m/config.json',
'./layers/oversize-overweight-truck-routes-gvw-up-to-80000-kg/config.json',
'./layers/oversize-overweight-truck-routes-gvw-up-to-85000-kg/config.json',
'./layers/oversize-overweight-truck-routes-gvw-up-to-125000-kg/config.json',
'./layers/port-of-vancouver-facilities-terminals/config.json',
'./layers/provincial-highway/config.json',
'./layers/truck-advisories-restrictions/config.json',
'./layers/truck-advisories-warning/config.json',
'./layers/truck-parking/config.json',
'./layers/truck-routes-designated-municipal-truck-route-with-restrictions/config.json',
'./layers/truck-routes-designated-municipal-truck-route/config.json',
'./layers/truck-routes-federal-road-with-no-truck-travel-restrictions/config.json',
'./layers/truck-routes-municipal-road-with-no-truck-travel-restriction/config.json',
'./layers/temporary-road-closure/config.json',
'./layers/temporary-road-closure-extent/config.json'
], [
'./config/map.json',
'./config/layer-display.json',
var layerConfigs = [
'./layers/cardlock/config.json',
'./layers/dangerous-goods-restrictions/config.json',
'./layers/downtown-vancouver/config.json',
'./layers/industrial-area/config.json',
'./layers/inspection-station/config.json',
'./layers/major-road-network/config.json',
'./layers/metro-vancouver-boundary/config.json',
'./layers/overhead-directional-signs/config.json',
'./layers/overhead-structure-with-height-marker/config.json',
'./layers/overhead-structure-without-height-marker/config.json',
'./layers/oversize-overweight-truck-routes-oah-up-to-4-88-m/config.json',
'./layers/oversize-overweight-truck-routes-oaw-up-to-5-m/config.json',
'./layers/oversize-overweight-truck-routes-gvw-up-to-80000-kg/config.json',
'./layers/oversize-overweight-truck-routes-gvw-up-to-85000-kg/config.json',
'./layers/oversize-overweight-truck-routes-gvw-up-to-125000-kg/config.json',
'./layers/port-of-vancouver-facilities-terminals/config.json',
'./layers/provincial-highway/config.json',
'./layers/truck-advisories-restrictions/config.json',
'./layers/truck-advisories-warning/config.json',
'./layers/truck-parking/config.json',
'./layers/truck-routes-designated-municipal-truck-route-with-restrictions/config.json',
'./layers/truck-routes-designated-municipal-truck-route/config.json',
'./layers/truck-routes-federal-road-with-no-truck-travel-restrictions/config.json',
'./layers/truck-routes-municipal-road-with-no-truck-travel-restriction/config.json',
'./layers/temporary-road-closure/config.json',
'./layers/temporary-road-closure-extent/config.json'
]

var temp = document.createElement( 'div' )
document.body.appendChild( temp )

function dashedLine( outerWidth, outerColour, innerWidth, innerColour, innerDashes ) {
return [
{
tools: [ {
type: 'directions',
truckHeight: defaultVehicle.height,
truckWidth: defaultVehicle.width,
truckLength: defaultVehicle.length,
truckWeight: defaultVehicle.weight,
} ]
"strokeWidth": outerWidth,
"strokeColor": outerColour,
"strokeOpacity": 1,
"strokeCap": "butt"
},
'./config/key/route-planner.json',
'?'
] ),
} ).then( function () {
{
"strokeWidth": innerWidth,
"strokeColor": innerColour,
"strokeOpacity": 1,
"strokeCap": "butt",
"strokeDashes": innerDashes
}
]
}

function dashedLine1( width, outerColour, innerColour ) {
var innerWidth = width * 2 / 5
var dash1 = width * 3 / 5
var dash2 = width
return dashedLine( width, outerColour, width * 2 / 5, innerColour, dash1 + ',' + dash2 )
}

function solidLine( width, colour ) {
return {
"strokeWidth": width,
"strokeColor": colour,
"strokeOpacity": 1,
"strokeCap": "butt"
}
}

var thick1Low = 10, thick1High = 12,
thick2Low = 8, thick2High = 10,
thick3Low = 6, thick3High = 8,
thick4Low = 4, thick4High = 6,
thick5Low = 2, thick5High = 4

var style = {
'major-road-network-high-zoom': solidLine( thick2High, "#1067e6" ),
'major-road-network': solidLine( thick2Low, "#1067e6" ),

'oversize-overweight-truck-routes-gvw-up-to-125000-kg': solidLine( thick5Low, "#9b54ba" ),
'oversize-overweight-truck-routes-gvw-up-to-80000-kg': solidLine( thick5Low, "#ceace6" ),
'oversize-overweight-truck-routes-gvw-up-to-85000-kg': solidLine( thick5Low, "#9f74be" ),
'oversize-overweight-truck-routes-oah-up-to-4-88-m': solidLine( thick3Low, "#ff01c8" ),
'oversize-overweight-truck-routes-oaw-up-to-5-m': solidLine( thick4Low, "#17fae4" ),

'truck-routes-provincial-highway-high-zoom': dashedLine1( thick1High, '#000000', '#ffff00' ),
'truck-routes-provincial-highway': dashedLine1( thick1Low, '#000000', '#ffff00' ),

'truck-routes-designated-municipal-truck-route-high-zoom': dashedLine1( thick1High, "#47464f", "#ffffff" ),
'truck-routes-designated-municipal-truck-route': dashedLine1( thick1Low, "#47464f", "#ffffff" ),

'truck-routes-designated-municipal-truck-route-with-restrictions-high-zoom': dashedLine1( thick1High, "#47464f", "#ff0000" ),
'truck-routes-designated-municipal-truck-route-with-restrictions': dashedLine1( thick1Low, "#47464f", "#ff0000" ),

'truck-routes-federal-road-with-no-truck-travel-restrictions-high-zoom': dashedLine1( thick1High, "#47464f", '#ffff00' ),
'truck-routes-federal-road-with-no-truck-travel-restrictions': dashedLine1( thick1Low, "#47464f", '#ffff00' ),

'truck-routes-municipal-road-with-no-truck-travel-restriction-high-zoom': dashedLine1( thick1High, "#47464f", '#ffff00' ),
'truck-routes-municipal-road-with-no-truck-travel-restriction': dashedLine1( thick1Low, "#47464f", '#ffff00' ),
}

// initialize SMK so all modules are loaded
SMK.INIT( {
'smk-id': 999,
'smk-container-sel': temp,
// baseUrl: self.smkBaseUrl,
'smk-config': [ {
"viewer": {
"baseMap": "Gray",
"esriApiKey": "AAPKacb4ff83a3e34b4887bed2d86c318279EXFibvw9GBGQCOMSQBVRdU3aaWqj6GrdbTKGtSxq6MXtukzb2O7CSwa_bv1iY3ia",
}
} ]
} )
.then( function ( smk ) {
temp.parentElement.removeChild( temp )

// SMK has to be completely loaded before it can be patched
installSmkOverrides()

// load and resolve templates in layer configs
return layerConfigs.reduce( function( acc, cfgUrl ) {
var id = cfgUrl.toLowerCase().replace( /[^a-z0-9]+/g, '-' ).replace( /^[-]|[-]$/g, '' )
var tag = 'config-' + id

return acc.then( function ( cfgs ) {
return include( [ { url: cfgUrl, loader: 'template' } ], tag ).then( function ( inc ) {
var json = inc[ tag + '.config-json' ]
var replaced = templateReplace( json, function( template ) {
var res = JSON.stringify( eval( template ) )
// console.log(tag,template,res)
return res
} )
var c = JSON.parse( replaced )
cfgs.push( c )
return cfgs
} )
} )
}, Promise.resolve( [] ) )
} )
.then( function ( cfgs ) {
return SMK.INIT( {
'smk-container-sel': "#smk-map-frame",
'smk-config': [].concat( cfgs, [
'./config/map.json',
'./config/layer-display.json',
{
tools: [ {
type: 'directions',
truckHeight: defaultVehicle.height,
truckWidth: defaultVehicle.width,
truckLength: defaultVehicle.length,
truckWeight: defaultVehicle.weight,
} ]
},
'./config/key/route-planner.json',
'?'
] )
} )
} )
.then( function () {
var fetchPromise = {}
function fetchLayer( layerName ) {
var pr = fetchPromise[ layerName ]
Expand All @@ -245,7 +355,7 @@

var preparePromise = {}
function prepareLayer( layerId, filter ) {
var vw = SMK.MAP[ 1 ].$viewer
var vw = SMK.MAP[ 2 ].$viewer
var ly = vw.layerId[ layerId ]

Object.defineProperty( ly, 'loadCache', {
Expand Down Expand Up @@ -403,7 +513,7 @@
$( e.target ).click()
} )

$( 'body' ).addClass( 'device-' + SMK.MAP[ 1 ].$device )
$( 'body' ).addClass( 'device-' + SMK.MAP[ 2 ].$device )

SMK.HANDLER.set( 'bespoke--feedback', 'initialized', function ( smk ) {} )

Expand Down Expand Up @@ -594,6 +704,28 @@
function htmlTemplate( template, data ) {
return ( new Vue( { template: '<div>' + template + '</div>', data: data } ) ).$mount().$el.innerHTML
}

function templateReplace( template, replacer ) {
if ( !template ) return template
if ( !replacer ) return template

var patt = /"<@=\s*(.*?)\s*@>"/g

var m = String( template ).match( patt );
if ( !m ) return template;

replacer = ( function ( inner ) {
return function ( templ, match ) {
var r = inner.apply( null, arguments )
return r == null ? match : r
}
} )( replacer )

return String( template ).replace( patt, function ( match, template ) {
return replacer( template, match )
} )
}

} )()
</script>
</body>
Expand Down
Loading