custom m -value tool and conversion ... - transportation.org · 2019 gis-t april 24,20 19 custom m...
TRANSCRIPT
2019 GIS-T April 24 ,20 19
CUSTOM M-VALUE TOOL AND CONVERSION OF LEGACY TOOLS FOR ARCGIS P RO20 19 GIS-T
2019 GIS-T April 24 ,20 19
Table of Contents
2
4-7
8-10
11-15
16-38
39
3
40 -41
Background: Our Story
Our legacy workflow, using ArcMap
Transition to ArcGIS Pro
ArcGIS Pro Tasks
Custom Tool Development
Live Demo
Resources and Contact Info
1
2
3
4
5
6
7
2019 GIS-T April 24 ,20 19
Background: Our Story
▪ Not a Roads and Highways shop
▪ De ve lope d our own cus tom solut ion – GRID (Ge ospat ia l Roadway Inve ntory Database )
▪ Digit ize roadway line work outs ide of GRID
– ETL to GRID
– GRID UI prim arily use dfor m anaging as se ts
▪ Use ArcMap v10 .3
3
2019 GIS-T April 24 ,20 19
Our Legacy Workflow, using ArcMap
▪ Digit ize a ll roadway line work in ArcMap and load to GRID
– De ve lope d cus tom tools /toolbars
• Quality Assurance
• ETL P acke t cre at ion
• Bulkloading as se ts
4
2019 GIS-T April 24 ,20 19
Our Legacy Workflow, using ArcMap
▪ Cus tom toolbars
– MrGRIDBar – QA validat ion che cks (a t t ribute and ge om e try)
• Exam ple s :
– Match (i.e . corre ct re la t ionship be twe e n route nam e and route IDs )
– County nam e m atche s county ID in route ID
– All fie lds are populate d
– Corre ct s e gm e nt le ngth
– No duplicate ve rt ice s
– No ove rlapping m e asure s
– Etc., e tc .
5
2019 GIS-T April 24 ,20 19
Our Legacy Workflow, using ArcMap
▪ Cus tom toolbars
– ETL Toolbar
• Addit ional che cks
• Asse m ble s e dit s into xm l and gm l file s for ETL to GRID
6
2019 GIS-T April 24 ,20 19
Our Legacy Workflow, using ArcMap
▪ Cus tom toolbars
– BLT Toolbar (i.e . bulkload toolbar)
• Que rie s GRID database for as se ts
• Fills gaps and corre cts ove rlaps
• P re populate s de fault value s for m is s ing as se ts
• Asse m ble s e dit s into ETL packe t
7
2019 GIS-T April 24 ,20 19
Switch to ArcPro
▪ Why?
– Ge t ahe ad of e ve ntual de pre cat ion of ArcMap
– Edit ing is s im ple r/s t re am line d
– Quality Assurance opportunity
• Use “tasks” to autom ate and guide use rs through prope r workflow
– Built in
– Cus tom izable
8
2019 GIS-T April 24 ,20 19
Switch to ArcPro
▪ Is sue s
– Ne e d to conve rt /re write a ll cus tom tools /toolbars
• Ne w, unfam iliar coding language : C#
– No counte rpart for the Ide nt ify Route Locat ions tool in ArcMap for ide nt ifying m e asure s (i.e . M value s )
– No tool for e nte ring M-value s
9
2019 GIS-T April 24 ,20 19
Switch to ArcPro
▪ Solut ion
– De ve lop our own m e asure tools
– Le arn C#
• C# t ra ining
• Esri De ve lope rs Sum m it
10
2019 GIS-T April 24 ,20 19
Switch to ArcPro – Tasks for Quality Assurance
▪ Se t of pre configure d se que nt ia l s te ps that guide use rs through a re pe atable workflow to e nsure cons is te ncy and quality
11
2019 GIS-T April 24 ,20 19
Switch to ArcPro – Tasks for Quality Assurance
▪ Use to guide and share knowle dge
– ne w pe rson or ne w software
▪ Inte ract ive
– se le ct or cre ate fe ature s
▪ Im prove e fficie ncy
– m inim ize m ouse clicks
▪ Im prove quality
– catch e rrors as the y happe n
– no addit ional QA ne e de d
▪ Tasks use your (bus ine s s ) language
▪ Tasks are configurable (no coding)
12
2019 GIS-T April 24 ,20 19
Switch to ArcPro – Tasks for Quality Assurance
Tasks can be e as ily cre ate d in ArcGIS P ro
• Steps – guide s the use r through workflow
– Se que nt ia l
– Loads act ions /com m ands for use r to pe rform
– Re quire d or opt ional
13
Task Ite m
Task
Ste p
Task de script ion
2019 GIS-T April 24 ,20 19
Switch to ArcPro – Tasks for Quality Assurance
STEP BEHAVIORS
• P roce e d autom at ically or m anually
• Manual
• Auto Run
• Auto P roce e d
• Autom at ic
• hidde n
• Opt ional
14
2019 GIS-T April 24 ,20 19
Demo: Tools, Code, and Resources
I. Resources to get started
II. M-Value Tool(Set From/To Measures)
III. Identify Route Location Tool
IV. Explore code for Launching a Python Script via ArcGIS Pro
V. Demo
VI. TxDOT Resources
15
2019 GIS-T April 24 ,20 19
Getting Started
▪ Microsoft Visual Studio 20 17
▪ Esri’s ArcGIS P ro SDK for Microsoft .NET page
16
2019 GIS-T April 24 ,20 19
Getting Started
17
2019 GIS-T April 24 ,20 19
Getting Started
18
2019 GIS-T April 24 ,20 19
Getting Started
19
2019 GIS-T April 24 ,20 19
Getting Started
20
2019 GIS-T April 24 ,20 19
M-Value Tool
John Phillips
GIS Analyst - TxDOT
21
2019 GIS-T April 24 ,20 19
M-Value Tool
▪ Doe sn’t Exis t in ArcGIS P ro
▪ How to build it?
– Original de s ign
• Utilize d the Cre ate Route s ge oproce s s ing tool
• Downs ide , cre ate d a ne w fe ature in fe ature clas s ra the r than m odifying e xis t ing fe ature
– Update d de s ign
• Found the Es ri m e thod in the ArcGIS P ro SDK to s e t and inte rpolate M value s on a line
• How to wire it?
22
2019 GIS-T April 24 ,20 19
M-Value Tool
▪ Add a Dock P ane
– Allow for inputs of Be gin and End m e asure s
23
2019 GIS-T April 24 ,20 19
M-Value Tool
▪ Things to cons ide r whe n writ ing code
– Ne e d the te xt input boxe s to display the curre nt m e asure s of the line if pre se nt
– What to do whe n accide ntally s e le ct ing m ore than one fe ature
24
2019 GIS-T April 24 ,20 19
M-Value Tool
25
2019 GIS-T April 24 ,20 19
Identify Route Location
▪ Available in “Locat ion Re fe re ncing” lice nse aka Roads and Highways , but not available for ArcGIS P ro quite ye t
▪ How to build it?
– Curre nt De s ign
• Split tool
– Whe n clicking on a line :
»Split s the line a t the point whe re clicke d
»Com pare s the m in/m ax value s of both ne w line s and re turns the m atch
»Undoe s the split
– Downs ide , this is cons ide re d an Edit Ope rat ion and is in the Edit Stack
26
0 5 105
2019 GIS-T April 24 ,20 19
Identify Route Location
– Potential updated design
• JSON
– When clicking on a line:
» Reads the line to JSON
» Converts the JSON to a new line in memory
» Insert a new point where “clicked”
» Re-interpolate measures
» Convert new line to JSON
» Pull the M -value from newly added point by comparing list of M’s from new JSON and original JSON
» Delete memory
– Shouldn’t be considered an Edit Operation and therefore not in the Edit Stack
27
2019 GIS-T April 24 ,20 19
Identify Route Location
28
2019 GIS-T April 24 ,20 19
Launch Python Script
▪ Esri’s ArcGIS P ro SDK sam ple s page provide s an e xam ple of how to launch a s cript
– We ne e de d our s cript to inte ract with a s e le ct ion m ade in ArcGIS P ro
– Our scripts are m os t ly in P ython 2.7 while the ir e xam ple s are for 3 .x
▪ How to pas s the s e le cte d re cords to the s cript?
– Cursors e xis t in the P ro SDK but not as the y do in arcpy
– But…The re is a way to ge t the OID’s from the s e le ct ion
29
2019 GIS-T April 24 ,20 19
Launch Python Script
30
2019 GIS-T April 24 ,20 19
Launch Python Script
▪ Se t t ing up the s cript to inte ract with the laye rs in the m ap
– Se t t ing curre nt m ap vie w to variable
– Ste pping into that vie w and se t t ing a ll laye rs to a lis t as a variable
– De fining the firs t laye r in lis t as a variable
31
2019 GIS-T April 24 ,20 19
Launch Python Script
32
2019 GIS-T April 24 ,20 19
Launch Python Script
▪ Que ue d task
– Runs it in the background
• Won’t bog down/lock up the UI
▪ Use s the Ge tSe le ct ion() m e thod followe d by the Ge tObje ct IDs () m e thod to pull the OID’s from the s e le cte d laye r and se t the m to a Re ad Only Lis t
▪ Form ats the lis t of OID’s to a com m a se parate d s t ring and se ts it to a variable
33
2019 GIS-T April 24 ,20 19
Launch Python Script
34
2019 GIS-T April 24 ,20 19
Launch Python Script
▪ Cre at ing a ne w proce s s and s e t t ing it to a variable
▪ Se t t ing the path to the python.e xe
▪ Se t t ing the python s cript to a variable
▪ P ass ing the variable s for the s cript and the s t ring of OID’s as argum e nts
▪ Se t t ing a fe w addit ional prope rt ie s and s tart ing s cript
35
2019 GIS-T April 24 ,20 19
Launch Python Script
▪ Im port sys library
▪ Use the sys .argv which looks for the argum e nts you pas se d from C#
– Se t to a variable
• Not ice the argv[1]
– Re call the two argum e nts from the C# code , the firs t was the python script path, the s e cond was the com m a se parate d s t ring
– P ass the variable into a Whe re Clause for the Se le ct By At t ribute
36
2019 GIS-T April 24 ,20 19
Launch Python Script
37
2019 GIS-T April 24 ,20 19
Launch Python Script
▪ This final pie ce is spe cific to our python script
▪ The python script cre ate s a fe ature table whe n an e rror is de te cte d
▪ The code above adds the fe ature table to the m ap vie w
– It has to wait for the python script to finish
• Start .WaitForExit ();
38
2019 GIS-T April 24 ,20 19
Demo
39
2019 GIS-T April 24 ,20 19
TxDOT Resources
▪ TxDOT github page for P ro LRS Tools
ht tps ://github.com /TxDOT/P ro-LRS-Tools
40
2019 GIS-T April 24 ,20 19
Questions?
▪ Contact Info
– Chris Bardash – Chris .Bardash@txdot .gov
– John P hillips – John.N.P hillips@txdot .gov
– Je re m y Roge rs – Je re m y.Roge rs@txdot .gov
41