Skip to content

Commit

Permalink
fix: switch out SGID-based UTA data for UTA's portal
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Aug 26, 2024
1 parent 53e0080 commit 3c100bf
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"firebaserc",
"GOED",
"hostingchannels",
"lightrail",
"lyrs",
"prebuild",
"QUALTRICS",
"seiyria",
Expand Down
8 changes: 4 additions & 4 deletions lib/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ define([
};

// lightrail rail (hidden)
var hiddenCheckbox = query('.layer input[value="16"]')[0];
var hiddenCheckbox = query('.layer input[value="lightrail rail (hidden)"]')[0];
// Commuter Rail
var lrCheckbox = query('.layer input[value="15"]')[0];
var lrCheckbox = query('.layer input[value="Commuter Rail"]')[0];
on(lrCheckbox, 'change', lang.partial(syncCheckbox, hiddenCheckbox));

// commuter rail (hidden)
hiddenCheckbox = query('.layer input[value="22"]')[0];
hiddenCheckbox = query('.layer input[value="commuter rail (hidden)"]')[0];
on(lrCheckbox, 'change', lang.partial(syncCheckbox, hiddenCheckbox));

// commuter rail stations (hidden)
hiddenCheckbox = query('.layer input[value="21"]')[0];
hiddenCheckbox = query('.layer input[value="commuter rail stations (hidden)"]')[0];
on(lrCheckbox, 'change', lang.partial(syncCheckbox, hiddenCheckbox));

// same thing for airports layers
Expand Down
28 changes: 24 additions & 4 deletions lib/app/Layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,14 @@ define([
// For dynamic layers could be multiple ids
// separated by a comma e.g. 2, 3, 4
// For feature layers this is always a single value
// This property is mutually exclusive with url
layerId: null,

// url: String
// The url to the feature service
// This property is mutually exclusive with layerId
url: null,

// onByDefault: Boolean (optional)
onByDefault: false,

Expand All @@ -92,6 +98,17 @@ define([
// cachedServiceUrl to the cached map service
cachedServiceUrl: null,

checkBoxValue: null,


postMixInProperties: function () {
// enforce mutual exclusivity for layerId and url
if (this.layerId && this.url) {
throw new Error('layerId and url are mutually exclusive');
}

this.checkboxValue = this.layerId || this.name;
},

postCreate: function () {
// summary:
Expand Down Expand Up @@ -144,7 +161,7 @@ define([
onRouterToggleLayers(lyrs) {
console.log('app/Layer:onRouterToggleLayers', arguments);

var vis = lyrs.indexOf(this.layerId) !== -1;
var vis = lyrs.indexOf(this.checkboxValue) !== -1;
this.checkbox.checked = vis;
this.toggleLayer(vis);
},
Expand Down Expand Up @@ -184,7 +201,7 @@ define([
this.markerHeight || config.markerSymbolHeight
);
markerSymbol.setOffset(0, config.markerSymbolHeight / 2);
this.layer = new FeatureLayer(config.urls.mapService + '/' + this.layerId, {
this.layer = new FeatureLayer(this.getUrl(), {
outFields: ['*']
});
this.layer.setRenderer(new SimpleRenderer(markerSymbol));
Expand All @@ -205,7 +222,7 @@ define([
break;
case 'polygon':
if (!this.layer) {
this.layer = new FeatureLayer(config.urls.mapService + '/' + this.layerId, {
this.layer = new FeatureLayer(this.getUrl(), {
outFields: ['*'],
opacity: this.defaultOpacity || 0.5
});
Expand Down Expand Up @@ -252,7 +269,7 @@ define([
);
lineSymbol.setColor(new Color(this.color));
lineSymbol.setWidth(6);
this.layer = new FeatureLayer(config.urls.mapService + '/' + this.layerId, {
this.layer = new FeatureLayer(this.getUrl(), {
outFields: ['*']
});
this.layer.setRenderer(new SimpleRenderer(lineSymbol));
Expand Down Expand Up @@ -280,6 +297,9 @@ define([
break;
}
topic.publish(config.topics.router.updateLayer);
},
getUrl: function () {
return this.url || config.urls.mapService + '/' + this.layerId;
}
});
});
19 changes: 11 additions & 8 deletions lib/app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ define([
apiKey = 'AGRC-FE1B257E901672';
quadWord = 'wedding-tactic-enrico-yes';
} else {
// localhost
// local development
domain = 'https://mapserv.dev.utah.gov/';
}
var baseUrl = domain + 'arcgis/rest/services/BBEcon/';

Expand Down Expand Up @@ -233,37 +234,39 @@ define([
defaultOpacity: 1,
color: '#E09525'
}, {
// if you change name make sure to change the code in
// app/App:postCreate as well
name: 'Commuter Rail',
type: 'feature',
layerId: '15',
url: 'https://maps.rideuta.com/server/rest/services/Hosted/TRAX_Light_Rail_Stations/FeatureServer/0',
marker: 'lightrail.svg'
}, {
// this is hidden and linked to Commuter rail above
// if you change the layerId make sure to change the code in
// if you change name make sure to change the code in
// app/App:postCreate as well
name: 'lightrail rail (hidden)',
type: 'line',
layerId: '16',
url: 'https://maps.rideuta.com/server/rest/services/Hosted/UTA_TRAX_Light_Rail_Routes/FeatureServer/0',
defaultOpacity: 1,
hidden: true,
color: '#AD6F29'
}, {
// this is hidden and linked to Commuter rail above
// if you change the layerId make sure to change the code in
// if you change name make sure to change the code in
// app/App:postCreate as well
name: 'commuter rail (hidden)',
type: 'line',
layerId: '22',
url: 'https://maps.rideuta.com/server/rest/services/Hosted/UTA_FrontRunner_Commuter_Rail_Centerline/FeatureServer/0',
defaultOpacity: 1,
hidden: true,
color: '#AD6F29'
}, {
// this is hidden and linked to Commuter rail above
// if you change the layerId make sure to change the code in
// if you change name make sure to change the code in
// app/App:postCreate as well
name: 'commuter rail stations (hidden)',
type: 'feature',
layerId: '21',
url: 'https://maps.rideuta.com/server/rest/services/Hosted/FrontRunnerStations/FeatureServer/0',
marker: 'lightrail.svg',
hidden: true
}, {
Expand Down
2 changes: 1 addition & 1 deletion lib/app/templates/Layer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<li class='checkbox'>
<input type="checkbox" id='${id}_chbx'
data-dojo-attach-point='checkbox' value='${layerId}'>
data-dojo-attach-point='checkbox' value='${checkboxValue}'>
<label for='${id}_chbx' data-dojo-attach-point='label'>
${name}
<div data-dojo-attach-point='tooltip' data-toggle="tooltip" class='hidden'>
Expand Down
Binary file modified maps/Maps.aprx
Binary file not shown.
4 changes: 0 additions & 4 deletions scripts/locate_pallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ def build(self, target):
self.add_crate(('ZoomLocations', self.sgid, self.location))

self.add_crates(['AirportLocations',
'CommuterRailRoutes_UTA',
'CommuterRailStations_UTA',
'LightRailStations_UTA',
'LightRail_UTA',
'Railroads',
'Roads'],
{'source_workspace': self.sgid,
Expand Down

0 comments on commit 3c100bf

Please sign in to comment.