This gist contains ArcGIS Arcade expressions.
Last active
September 6, 2018 20:35
-
-
Save JeffJacobson/5a3b14b98e2a6305d88f3ee7309e6b7b to your computer and use it in GitHub Desktop.
WSDOT Arcade expressions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gets the Open Data portal URL filtered to just this location | |
"https://gisdata-wsdot.opendata.arcgis.com/datasets/46a11f7e043842a5bfbbb1b69e7e4900_0/data?where=LocationID%20%3D%20%27" + $feature.LocationID + "%27" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extract county identifier and convert to number. | |
var cid = Number(Mid($feature.RouteId, 2, 3)) | |
// Return the county name corresponding to the county id. | |
Decode ( | |
cid, | |
1, "Adams", | |
3, "Asotin", | |
5, "Benton", | |
7, "Chelan", | |
9, "Clallam", | |
11, "Clark", | |
13, "Columbia", | |
15, "Cowlitz", | |
17, "Douglas", | |
19, "Ferry", | |
21, "Franklin", | |
23, "Garfield", | |
25, "Grant", | |
27, "Grays Harbor", | |
29, "Island", | |
31, "Jefferson", | |
33, "King", | |
35, "Kitsap", | |
37, "Kittitas", | |
39, "Klickitat", | |
41, "Lewis", | |
43, "Lincoln", | |
45, "Mason", | |
47, "Okanogan", | |
49, "Pacific", | |
51, "Pend Oreille", | |
53, "Pierce", | |
55, "San Juan", | |
57, "Skagit", | |
59, "Skamania", | |
61, "Snohomish", | |
63, "Spokane", | |
65, "Stevens", | |
67, "Thurston", | |
69, "Wahkiakum", | |
71, "Walla Walla", | |
73, "Whatcom", | |
75, "Whitman", | |
77, "Yakima", | |
"Invalid" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extract and return the road number. | |
Mid($feature.RouteId, 5, 5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSpeciesName(abbrev) { | |
console(abbrev) | |
return Decode(abbrev, "SO", "Sockeye","CH", "Chum","PK", "Pink","CO", "Coho","CK", "Chinook","SH", "Steelhead","SRCT", "Sea run cutthroat","RT", "Resident","BT", "Bull Trout","Unknown"); | |
} | |
var list = []; | |
var abbrevList = Split($feature.Species, ",", 20, true); | |
console(abbrevList); | |
for (var i in abbrevList) { | |
var item = Trim(abbrevList[i]); | |
console(item); | |
list[i] = getSpeciesName(item); | |
} | |
return Concatenate(Sort(list), ", "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"https://www.wsdot.wa.gov/environmental/biology/fishpassage/?id=" + Replace($feature.Site_Num, " ", "+") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseDateInt(dateInt) { | |
var day = dateInt % 100; | |
var month = (((dateInt - day) % 10000) / 100) - 1; | |
var year = (dateInt - dateInt % 10000) / 10000 | |
return Date(year, month, day) | |
} | |
parseDateInt($feature.LRS_Date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For use with https://data.wsdot.wa.gov/arcgis/rest/services/Traffic/PTRSites/MapServer | |
// Outputs a URL to a site where user can download CSV files related to the current site. | |
'https://www.wsdot.wa.gov/Traffic/API/PermanentTrafficRecorder/?siteId=' + $feature["ADCTrafficSDE.DBO.PTRSites.SiteID"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment