SlideShare a Scribd company logo
1 of 26
Download to read offline
ELIZABETH MCDOWELL 
MESA COUNTY GIS 
PYTHON & THE CERR CHALLENGE PROCESS
SEVERANCE TAX FUND 
Fifty percent of the State’s receipts from the severance tax on minerals and mineral fuels are credited to the Local Government Severance Tax Fund. The Department of Local Affairs (DOLA) is directed to allocate 70% of these funds to local governments through discretionary grants and loans under the Energy and Mineral Impact Assistance Program. The remaining 30% is distributed directly to the municipalities and counties economically and socially impacted by mineral production based on certain measurable factors determined by the General Assembly. 
Colorado Employee Residence Reports (CERR) are submitted by reporting parties and are used as one of the factors to determine the severance tax allocations to and within counties. 
(State of Colorado. Department of Local Affairs. Federal Mineral Lease and State Severance Tax Direct Distribution: Program Guidelines, June 2011)
FOR 2013 REPORTING YEAR 
•237 CERRs (with Mesa County addresses) 
•233 Companies 
•16,088 Total Employees 
•3,261 Employee Addresses within Mesa County 
•356 Not Challengeable 
•106 Invalid Addresses (Incl. PO Boxes, bad addresses) 
•879 Challenged Addresses 
Jurisdiction 
Company Reported Employees 
Post-Challenge Employees 
Net Gain 
City of Fruita 
328 
298 
-30 
City of Grand Junction 
1769 
1150 
-619 
Mesa County 
994 
1689 
695 
Town of Collbran 
28 
18 
-10 
Town of De Beque 
56 
45 
-11 
Town of Palisade 
86 
72 
-14 
Garfield County 
4 
0 
-4 
Town of Parachute 
7 
0 
-7 
TOTAL 
3272 
3272 
0 
+21%
MESA COUNTY ALLOCATION 
Direct Distribution Payment - 2014 
$1,723,565.20
COLORADO EMPLOYEE RESIDENCE REPORTS 
•Employers submit lists of employees involved in mineral extraction that meet the following: 
•Worked ≥ 500 hours in Colorado in any 6 months during the reporting year 
•Worked for the purpose of extraction within Colorado 
•Submission guidelines: 
•Report only employees during reporting year period 
•Report only Colorado employees 
•Report the PHYSICAL LOCATION of employee’s residence in Colorado (not mailing address) 
•No PO Boxes
WHAT WE GET 
•Lists of employees that do not meet mineral extraction requirements 
•PO Boxes 
•Incorrect / invalid addresses 
•Addresses listed in the wrong jurisdiction 
Communication from Local Governments back to Employers can 
help improve the overall quality of employee reports
MESA COUNTY GIS 
•Processes CERRs for municipalities within Mesa County 
•City of Grand Junction 
•City of Fruita 
•Town of Palisade 
•Town of De Beque 
•Town of Collbran 
•Include surrounding Counties/Municipalities in process 
•Garfield County 
•Town of Parachute
APPLICATIONS USED 
•CERRs provided as Microsoft Excel workbooks 
•VBA Script to merge multiple workbooks 
•Manually add, populate and rename fields 
•Work in batches as CERRs become available 
•Maintain data in SQL database 
•Scripts to prep data for geocoding in ArcGIS 
•Union batch tables/views 
•Reporting 
•ESRI ArcMap 10.1 and PythonWin 2.7.2 
•Geocoding 
•Intersects, Spatial Joins 
•Supporting Documentation
WHY PYTHON? 
•ESRI Marketing 
•Online Python class 
•Python based sessions at the ESRI Developer Conference, March 2014 
•Data Driven Pages enhanced with Python 
GOAL: 
Use python scripting with DDP to create supporting documentation for address challenges
CHALLENGE PROCESS OVERVIEW 
1.Download / Prep CERRs for Processing 
2.Geocoding / Address Verification 
3.Supporting Documentation 
4.Submit Challenges on DOLA’s Website 
In previous years supporting documentation was created from Assessor’s Property Detail 
-Individually created per challenge address 
-For 2012 Reporting Year: >1000 
http://emap.mesacounty.us/assessor_lookup/
SUPPORTING DOCUMENTATION 
•State Requirements: 
•A current map or property tax record showing the address is within the municipal limits or located in unincorporated county territory may be used. In addition, a letter from both the municipality and the county agreeing to the address location may be used. (DOLA Direct Distribution Frequently Asked Questions (FAQ) July 2014) 
•ArcMap Data Driven Pages 
•Solution to combine a current map with property tax table for multiple properties 
•Leverages existing County GIS data 
•Greatly reduces tedium of individually creating PDFs from website
DATA DRIVEN PAGE SETUP 
•Input Layer 
•Spatial join of geo-coded address layer with parcel data 
•Copy of input layer used as the Page Definition Query to only show the active address on each page 
•DDP Extent 
•Since parcel size varies greatly used “Best Fit” with a 1500% Margin to get suitable surrounding areas around small parcels. 
•Inset Maps 
•One of each municipality and one County-wide 
•Extent indicator on main data frame to show where property is located in reference to municipal boundary
PYTHON SCRIPT COMPONENTS 
•General Settings 
•Map Document Variables 
•Looping through Pages 
•Map Layout 
•Dynamic Layout Elements 
•Export to PDF 
Python script available on github: 
https://github.com/emcdowell/Python-CERR.git
GENERAL SETTINGS 
•Set Directory Paths / Output PDF 
•Script Parameters 
•Used to select different input without having to change code 
inputLayer = arcpy.GetParameterAsText(0) 
•Allow script to overwrite outputs 
arcpy.env.overwriteOutputs = True
MAP DOCUMENT VARIABLES 
Set up map document variables 
mxd = arcpy.mapping.MapDocument(mxdpath) 
ddp = mxd.dataDrivenPages 
dataframes = arcpy.mapping.ListDataFrames(mxd, '') 
actDataframe = arcpy.mapping.ListDataFrames(mxd, '')[0] 
Define input table and temporary table variables 
inputTable = r'S:ITGISLizPythonCERRDataPython_CERR.gdbMC_TAC_AgencyCodes' 
tempTable = r'S:ITGISLizPythonCERRDataPython_CERR.gdbtempTable' 
Define field variables
LOOPING 
Script has multiple loops 
•Primary Loop: 
•Loop through each page using page number 
for pgNum in range(1, ddp.pageCount + 1): 
ddp.currentPageID = pgNum 
•Secondary & Tertiary Loops: 
•Script loops through scenarios within each page 
•Search & Insert Cursor 
•Layout element positioning 
•if…elif statements with 
nested for…in statements
# Set variables to set data frame insets 
reportedDistrict = ddp.pageRow.getValue(qMuni_County) 
newDistrict = ddp.pageRow.getValue(qDistrict) 
if reportedDistrict == 'City of Grand Junction': 
lblGrandJunction.elementPositionX = 8.27 
lblGrandJunction.elementPositionY = 2.63 
lblFruita.elementPositionX = 10.0 
lblCollbran.elementPositionX = 10.0 
lblDebeque.elementPositionX = 10.0 
lblPalisade.elementPositionX = 10.0 
lblCounty.elementPositionX = 12.0 
txtCounty.elementPositionX = 3.18 
txtCounty.elementPositionY = 1.07 
txtGrandJunction.elementPositionX = 10.0 
txtFruita.elementPositionX = 10.0 
txtCollbran.elementPositionX = 10.0 
txtDebeque.elementPositionX = 10.0 
txtPalisade.elementPositionX = 10.0 
for frames in dataframes: 
if frames.name == 'df_GJT': 
frames.elementPositionX = 5.7 
frames.elementPositionY = 0.5 
elif frames.name == 'df_Address': 
frames.elementPositionX = 0.2745 
frames.elementPositionY = 2.9452 
else: 
frames.elementPositionX = 8.8 
frames.elementPositionY = 0.7 
elif reportedDistrict == ‘Mesa County’:
MAP LAYOUT ELEMENTS 
•Each layout item MUST be uniquely named 
•Size and Position Tab 
•Element Name 
•Create and do preliminary setup in ArcMap then use Python to further manipulate the element
SCALE BAR 
# Set scale bar based on page extent 
if actDataframe.scale < 4000: 
scale1.elementPositionX = 0.33 
scale1.elementPositionY = 2.98 
scale2.elementPositionX = 11.6 
scale3.elementPositionX = 11.6 
scale4.elementPositionX = 11.6 
elif 4001 <= actDataframe.scale <= 10000: 
scale1.elementPositionX = 11.6 
scale2.elementPositionX = 0.33 
scale2.elementPositionY = 2.98 
scale3.elementPositionX = 11.6 
scale4.elementPositionX = 11.6 
elif 10001 <= actDataframe.scale <= 20000: 
scale1.elementPositionX = 11.6 
scale2.elementPositionX = 11.6 
scale3.elementPositionX = 0.33 
scale3.elementPositionY = 2.98 
scale4.elementPositionX = 11.6 
elif actDataframe.scale > 20001: 
scale1.elementPositionX = 11.6 
scale2.elementPositionX = 11.6 
scale3.elementPositionX = 11.6 
scale4.elementPositionX = 0.33 
scale4.elementPositionY = 2.98 
•Create four scale bars in ArcMap 
•Set Division Value for each 
•Determine placement on layout 
•Use Python to change X,Y location based on the scale of the active data frame
SEARCH & INSERT CURSORS 
•Search Cursor 
•Use For … In… to match record in input table to page variable 
•Insert Cursor 
•Populate temporary table with matching records 
cursor = arcpy.da.SearchCursor(inputTable, ('TAC_Code', 'Year_', 'Agency_Name'), ''' "Year_" = 2013 ''') 
insertcursor = arcpy.da.InsertCursor(tempTable, ('TAC_Code', 'Year_', 'Agency_Name')) 
for row in cursor: 
if row[0] == pgTAC: 
insertcursor.insertRow(row) 
del row 
del insertcursor 
del cursor 
cursor = arcpy.da.SearchCursor(inputTable, ('TAC_Code', 'Year_', 'Agency_Name'), ''' "Year_" = 2013 ''') 
insertcursor = arcpy.da.InsertCursor(tempTable, ('TAC_Code', 'Year_', 'Agency_Name'))
DYNAMIC TABLE 
•Built using Python’s Search and Insert cursors 
•Lists taxing authorities per challenge address 
•Verifies that a parcel is located inside or outside of municipal boundary 
•Based on the number of rows in the table, script will adjust text size, row height, grid line positioning 
#Set and clone cell text elements 
cellTxt.fontSize = rowHeight / 0.0155 
y = upperY - headerHeight 
rows = arcpy.SearchCursor("in_memorysort1") 
for row in rows: 
x = upperX + 0.05 
col1CellTxt = cellTxt.clone("_clone") 
col1CellTxt.text = row.getValue("Agency_Name") 
col1CellTxt.elementPositionX = x 
col1CellTxt.elementPositionY = y 
col2CellTxt = cellTxt.clone("_clone") 
col2CellTxt.text = row.getValue("TAC_Code") 
col2CellTxt.elementPositionX = x + 2.3 
col2CellTxt.elementPositionY = y 
y = y - rowHeight 
if col1CellTxt.elementWidth > 2: 
col1CellTxt.elementWidth = 2
EXPORT TO PDF 
# Set Output PDF (Beginning of script) 
pdfPath = outDir + r"FinalMapBook.pdf" 
if os.path.exists(pdfPath): # Check to see if file already exists, delete if it does 
os.remove(pdfPath) 
finalPdf = arcpy.mapping.PDFDocumentCreate(pdfPath) 
… 
# Name and export individual pages (Inside Loop through each page) 
ddp.exportToPDF(pgLabel + ".pdf", "CURRENT") 
finalPdf.appendPages(pgLabel + ".pdf") 
… 
# Commit Changes and delete variable references (Outside of loop) 
finalPdf.saveAndClose() 
del finalPdf
THREE HOURS I WAS ABLE TO SPEND WORKING ON SOMETHING ELSE! 
For batch size between 150 – 200 addresses
MOVING FORWARD 
•Significant time-saver (not counting the time it took to put the script together) 
•Will continue to work on script 
•Incorporate intersect and spatial join 
•Do more with parameters
LINKS 
•DDPwithDynamicTablesAndGraphs_10.1_v1 
http://www.arcgis.com/home/item.html?id=3a525b986b774a3f9cbbd8daf2435852 
•Merge Excel Workbooks 
http://msdn.microsoft.com/en-us/library/office/gg549168(v=office.14).aspx 
•My full script: 
https://github.com/emcdowell/Python-CERR.git

More Related Content

Similar to Python and the CERR Challenge Process

CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]
CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]
CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]CARTO
 
Lightweight Semantic Annotation of Geospatial RESTful Services
Lightweight Semantic Annotation of Geospatial RESTful ServicesLightweight Semantic Annotation of Geospatial RESTful Services
Lightweight Semantic Annotation of Geospatial RESTful ServicesBoris Villazón-Terrazas
 
Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02Victor Saquicela
 
Utilities Industry Success Stories with FME
Utilities Industry Success Stories with FME Utilities Industry Success Stories with FME
Utilities Industry Success Stories with FME Safe Software
 
Spatialware_2_Sql08
Spatialware_2_Sql08Spatialware_2_Sql08
Spatialware_2_Sql08Mike Osbourn
 
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...DataWorks Summit
 
Utah SGID: Parcel Layer Activities Update (UGIC 2011)
Utah SGID: Parcel Layer Activities Update (UGIC 2011)Utah SGID: Parcel Layer Activities Update (UGIC 2011)
Utah SGID: Parcel Layer Activities Update (UGIC 2011)SeanAGRC
 
The Sum of our Parts: the Complete CARTO Journey [CARTO]
The Sum of our Parts: the Complete CARTO Journey [CARTO]The Sum of our Parts: the Complete CARTO Journey [CARTO]
The Sum of our Parts: the Complete CARTO Journey [CARTO]CARTO
 
The Role of Data Science in Real Estate
The Role of Data Science in Real EstateThe Role of Data Science in Real Estate
The Role of Data Science in Real EstateCARTO
 
From Data to Maps to Docs: Turn Days into Minutes with Automated Integration
From Data to Maps to Docs: Turn Days into Minutes with Automated IntegrationFrom Data to Maps to Docs: Turn Days into Minutes with Automated Integration
From Data to Maps to Docs: Turn Days into Minutes with Automated IntegrationSafe Software
 
How to Use Spatial Data Science in your Site Planning Process? [CARTOframes]
How to Use Spatial Data Science in your Site Planning Process? [CARTOframes] How to Use Spatial Data Science in your Site Planning Process? [CARTOframes]
How to Use Spatial Data Science in your Site Planning Process? [CARTOframes] CARTO
 
Digital submittal
Digital submittalDigital submittal
Digital submittalgscplanning
 
Analyzing GIS Staff Usage and Allocation for Improved GIS Operations
Analyzing GIS Staff Usage and Allocation for Improved GIS OperationsAnalyzing GIS Staff Usage and Allocation for Improved GIS Operations
Analyzing GIS Staff Usage and Allocation for Improved GIS OperationsGreg Babinski
 
Savills - Smart Data - Esri UK Annual Conference 2017
Savills - Smart Data - Esri UK Annual Conference 2017Savills - Smart Data - Esri UK Annual Conference 2017
Savills - Smart Data - Esri UK Annual Conference 2017Esri UK
 
Common Ground, Local Assets: Collecting and Coordinating for a Regional Scope
Common Ground, Local Assets: Collecting and Coordinating for a Regional ScopeCommon Ground, Local Assets: Collecting and Coordinating for a Regional Scope
Common Ground, Local Assets: Collecting and Coordinating for a Regional ScopeRPO America
 
ASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptx
ASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptxASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptx
ASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptxVSKrishnaAchanta
 

Similar to Python and the CERR Challenge Process (20)

PythonCERR_2014
PythonCERR_2014PythonCERR_2014
PythonCERR_2014
 
CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]
CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]
CARTO en 5 Pasos: del Dato a la Toma de Decisiones [CARTO]
 
Lightweight Semantic Annotation of Geospatial RESTful Services
Lightweight Semantic Annotation of Geospatial RESTful ServicesLightweight Semantic Annotation of Geospatial RESTful Services
Lightweight Semantic Annotation of Geospatial RESTful Services
 
Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02Eswc lsagrsv9-boris-110602060147-phpapp02
Eswc lsagrsv9-boris-110602060147-phpapp02
 
Utilities Industry Success Stories with FME
Utilities Industry Success Stories with FME Utilities Industry Success Stories with FME
Utilities Industry Success Stories with FME
 
Spatialware_2_Sql08
Spatialware_2_Sql08Spatialware_2_Sql08
Spatialware_2_Sql08
 
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
Optimizing Geospatial Operations with Server-side Programming in HBase and Ac...
 
Utah SGID: Parcel Layer Activities Update (UGIC 2011)
Utah SGID: Parcel Layer Activities Update (UGIC 2011)Utah SGID: Parcel Layer Activities Update (UGIC 2011)
Utah SGID: Parcel Layer Activities Update (UGIC 2011)
 
The Sum of our Parts: the Complete CARTO Journey [CARTO]
The Sum of our Parts: the Complete CARTO Journey [CARTO]The Sum of our Parts: the Complete CARTO Journey [CARTO]
The Sum of our Parts: the Complete CARTO Journey [CARTO]
 
VOLT - ESWC 2016
VOLT - ESWC 2016VOLT - ESWC 2016
VOLT - ESWC 2016
 
The Role of Data Science in Real Estate
The Role of Data Science in Real EstateThe Role of Data Science in Real Estate
The Role of Data Science in Real Estate
 
From Data to Maps to Docs: Turn Days into Minutes with Automated Integration
From Data to Maps to Docs: Turn Days into Minutes with Automated IntegrationFrom Data to Maps to Docs: Turn Days into Minutes with Automated Integration
From Data to Maps to Docs: Turn Days into Minutes with Automated Integration
 
Meridian_Award
Meridian_AwardMeridian_Award
Meridian_Award
 
How to Use Spatial Data Science in your Site Planning Process? [CARTOframes]
How to Use Spatial Data Science in your Site Planning Process? [CARTOframes] How to Use Spatial Data Science in your Site Planning Process? [CARTOframes]
How to Use Spatial Data Science in your Site Planning Process? [CARTOframes]
 
CARTO ENGINE
CARTO ENGINECARTO ENGINE
CARTO ENGINE
 
Digital submittal
Digital submittalDigital submittal
Digital submittal
 
Analyzing GIS Staff Usage and Allocation for Improved GIS Operations
Analyzing GIS Staff Usage and Allocation for Improved GIS OperationsAnalyzing GIS Staff Usage and Allocation for Improved GIS Operations
Analyzing GIS Staff Usage and Allocation for Improved GIS Operations
 
Savills - Smart Data - Esri UK Annual Conference 2017
Savills - Smart Data - Esri UK Annual Conference 2017Savills - Smart Data - Esri UK Annual Conference 2017
Savills - Smart Data - Esri UK Annual Conference 2017
 
Common Ground, Local Assets: Collecting and Coordinating for a Regional Scope
Common Ground, Local Assets: Collecting and Coordinating for a Regional ScopeCommon Ground, Local Assets: Collecting and Coordinating for a Regional Scope
Common Ground, Local Assets: Collecting and Coordinating for a Regional Scope
 
ASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptx
ASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptxASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptx
ASUG82313 - Preparing to Migrate Data to SAP S4HANA Finance.pptx
 

More from GeCo in the Rockies

Fusion of Geodesy and GIS at NOAA as NGS
Fusion of Geodesy and GIS at NOAA as NGSFusion of Geodesy and GIS at NOAA as NGS
Fusion of Geodesy and GIS at NOAA as NGSGeCo in the Rockies
 
Stone national spatial reference system heights
Stone national spatial reference system   heightsStone national spatial reference system   heights
Stone national spatial reference system heightsGeCo in the Rockies
 
Edwards frontier precision terrestrial imagingandmeasurement
Edwards frontier precision terrestrial imagingandmeasurementEdwards frontier precision terrestrial imagingandmeasurement
Edwards frontier precision terrestrial imagingandmeasurementGeCo in the Rockies
 
Siddle connecting surveying and mgis to mesa countys rtrn
Siddle connecting surveying and mgis to mesa countys rtrnSiddle connecting surveying and mgis to mesa countys rtrn
Siddle connecting surveying and mgis to mesa countys rtrnGeCo in the Rockies
 
Londe mobile devices appropriate uses
Londe mobile devices appropriate usesLonde mobile devices appropriate uses
Londe mobile devices appropriate usesGeCo in the Rockies
 
Lowry colorado state address dataset data quality
Lowry colorado state address dataset data qualityLowry colorado state address dataset data quality
Lowry colorado state address dataset data qualityGeCo in the Rockies
 
Vetter employee residence reports weld county
Vetter employee residence reports weld countyVetter employee residence reports weld county
Vetter employee residence reports weld countyGeCo in the Rockies
 
Caldwell community sustainability and land use policy
Caldwell community sustainability and land use policyCaldwell community sustainability and land use policy
Caldwell community sustainability and land use policyGeCo in the Rockies
 
Behunin and lasslo inexpensive mobile mapping solutions
Behunin and lasslo inexpensive mobile mapping solutionsBehunin and lasslo inexpensive mobile mapping solutions
Behunin and lasslo inexpensive mobile mapping solutionsGeCo in the Rockies
 

More from GeCo in the Rockies (20)

Fusion of Geodesy and GIS at NOAA as NGS
Fusion of Geodesy and GIS at NOAA as NGSFusion of Geodesy and GIS at NOAA as NGS
Fusion of Geodesy and GIS at NOAA as NGS
 
Stone national spatial reference system heights
Stone national spatial reference system   heightsStone national spatial reference system   heights
Stone national spatial reference system heights
 
Buck appgeo
Buck appgeoBuck appgeo
Buck appgeo
 
Edwards frontier precision terrestrial imagingandmeasurement
Edwards frontier precision terrestrial imagingandmeasurementEdwards frontier precision terrestrial imagingandmeasurement
Edwards frontier precision terrestrial imagingandmeasurement
 
Siddle connecting surveying and mgis to mesa countys rtrn
Siddle connecting surveying and mgis to mesa countys rtrnSiddle connecting surveying and mgis to mesa countys rtrn
Siddle connecting surveying and mgis to mesa countys rtrn
 
Stone four corners monument
Stone four corners monumentStone four corners monument
Stone four corners monument
 
Isaac esri living atlas
Isaac esri living atlasIsaac esri living atlas
Isaac esri living atlas
 
Londe mobile devices appropriate uses
Londe mobile devices appropriate usesLonde mobile devices appropriate uses
Londe mobile devices appropriate uses
 
Lowry colorado state address dataset data quality
Lowry colorado state address dataset data qualityLowry colorado state address dataset data quality
Lowry colorado state address dataset data quality
 
Lindemann arc gis forlocalgovt
Lindemann arc gis forlocalgovtLindemann arc gis forlocalgovt
Lindemann arc gis forlocalgovt
 
Duran here presentation
Duran here presentationDuran here presentation
Duran here presentation
 
Underwood esri serug
Underwood esri serugUnderwood esri serug
Underwood esri serug
 
Korris national map corps
Korris national map corpsKorris national map corps
Korris national map corps
 
Chamberlain hazus
Chamberlain hazusChamberlain hazus
Chamberlain hazus
 
Gup web mobilegis
Gup web mobilegisGup web mobilegis
Gup web mobilegis
 
Vetter employee residence reports weld county
Vetter employee residence reports weld countyVetter employee residence reports weld county
Vetter employee residence reports weld county
 
Caldwell community sustainability and land use policy
Caldwell community sustainability and land use policyCaldwell community sustainability and land use policy
Caldwell community sustainability and land use policy
 
Caldwell uas
Caldwell uasCaldwell uas
Caldwell uas
 
Gijselaers lights camerang911
Gijselaers lights camerang911Gijselaers lights camerang911
Gijselaers lights camerang911
 
Behunin and lasslo inexpensive mobile mapping solutions
Behunin and lasslo inexpensive mobile mapping solutionsBehunin and lasslo inexpensive mobile mapping solutions
Behunin and lasslo inexpensive mobile mapping solutions
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

Python and the CERR Challenge Process

  • 1. ELIZABETH MCDOWELL MESA COUNTY GIS PYTHON & THE CERR CHALLENGE PROCESS
  • 2. SEVERANCE TAX FUND Fifty percent of the State’s receipts from the severance tax on minerals and mineral fuels are credited to the Local Government Severance Tax Fund. The Department of Local Affairs (DOLA) is directed to allocate 70% of these funds to local governments through discretionary grants and loans under the Energy and Mineral Impact Assistance Program. The remaining 30% is distributed directly to the municipalities and counties economically and socially impacted by mineral production based on certain measurable factors determined by the General Assembly. Colorado Employee Residence Reports (CERR) are submitted by reporting parties and are used as one of the factors to determine the severance tax allocations to and within counties. (State of Colorado. Department of Local Affairs. Federal Mineral Lease and State Severance Tax Direct Distribution: Program Guidelines, June 2011)
  • 3. FOR 2013 REPORTING YEAR •237 CERRs (with Mesa County addresses) •233 Companies •16,088 Total Employees •3,261 Employee Addresses within Mesa County •356 Not Challengeable •106 Invalid Addresses (Incl. PO Boxes, bad addresses) •879 Challenged Addresses Jurisdiction Company Reported Employees Post-Challenge Employees Net Gain City of Fruita 328 298 -30 City of Grand Junction 1769 1150 -619 Mesa County 994 1689 695 Town of Collbran 28 18 -10 Town of De Beque 56 45 -11 Town of Palisade 86 72 -14 Garfield County 4 0 -4 Town of Parachute 7 0 -7 TOTAL 3272 3272 0 +21%
  • 4. MESA COUNTY ALLOCATION Direct Distribution Payment - 2014 $1,723,565.20
  • 5. COLORADO EMPLOYEE RESIDENCE REPORTS •Employers submit lists of employees involved in mineral extraction that meet the following: •Worked ≥ 500 hours in Colorado in any 6 months during the reporting year •Worked for the purpose of extraction within Colorado •Submission guidelines: •Report only employees during reporting year period •Report only Colorado employees •Report the PHYSICAL LOCATION of employee’s residence in Colorado (not mailing address) •No PO Boxes
  • 6. WHAT WE GET •Lists of employees that do not meet mineral extraction requirements •PO Boxes •Incorrect / invalid addresses •Addresses listed in the wrong jurisdiction Communication from Local Governments back to Employers can help improve the overall quality of employee reports
  • 7. MESA COUNTY GIS •Processes CERRs for municipalities within Mesa County •City of Grand Junction •City of Fruita •Town of Palisade •Town of De Beque •Town of Collbran •Include surrounding Counties/Municipalities in process •Garfield County •Town of Parachute
  • 8. APPLICATIONS USED •CERRs provided as Microsoft Excel workbooks •VBA Script to merge multiple workbooks •Manually add, populate and rename fields •Work in batches as CERRs become available •Maintain data in SQL database •Scripts to prep data for geocoding in ArcGIS •Union batch tables/views •Reporting •ESRI ArcMap 10.1 and PythonWin 2.7.2 •Geocoding •Intersects, Spatial Joins •Supporting Documentation
  • 9. WHY PYTHON? •ESRI Marketing •Online Python class •Python based sessions at the ESRI Developer Conference, March 2014 •Data Driven Pages enhanced with Python GOAL: Use python scripting with DDP to create supporting documentation for address challenges
  • 10. CHALLENGE PROCESS OVERVIEW 1.Download / Prep CERRs for Processing 2.Geocoding / Address Verification 3.Supporting Documentation 4.Submit Challenges on DOLA’s Website In previous years supporting documentation was created from Assessor’s Property Detail -Individually created per challenge address -For 2012 Reporting Year: >1000 http://emap.mesacounty.us/assessor_lookup/
  • 11. SUPPORTING DOCUMENTATION •State Requirements: •A current map or property tax record showing the address is within the municipal limits or located in unincorporated county territory may be used. In addition, a letter from both the municipality and the county agreeing to the address location may be used. (DOLA Direct Distribution Frequently Asked Questions (FAQ) July 2014) •ArcMap Data Driven Pages •Solution to combine a current map with property tax table for multiple properties •Leverages existing County GIS data •Greatly reduces tedium of individually creating PDFs from website
  • 12. DATA DRIVEN PAGE SETUP •Input Layer •Spatial join of geo-coded address layer with parcel data •Copy of input layer used as the Page Definition Query to only show the active address on each page •DDP Extent •Since parcel size varies greatly used “Best Fit” with a 1500% Margin to get suitable surrounding areas around small parcels. •Inset Maps •One of each municipality and one County-wide •Extent indicator on main data frame to show where property is located in reference to municipal boundary
  • 13. PYTHON SCRIPT COMPONENTS •General Settings •Map Document Variables •Looping through Pages •Map Layout •Dynamic Layout Elements •Export to PDF Python script available on github: https://github.com/emcdowell/Python-CERR.git
  • 14. GENERAL SETTINGS •Set Directory Paths / Output PDF •Script Parameters •Used to select different input without having to change code inputLayer = arcpy.GetParameterAsText(0) •Allow script to overwrite outputs arcpy.env.overwriteOutputs = True
  • 15. MAP DOCUMENT VARIABLES Set up map document variables mxd = arcpy.mapping.MapDocument(mxdpath) ddp = mxd.dataDrivenPages dataframes = arcpy.mapping.ListDataFrames(mxd, '') actDataframe = arcpy.mapping.ListDataFrames(mxd, '')[0] Define input table and temporary table variables inputTable = r'S:ITGISLizPythonCERRDataPython_CERR.gdbMC_TAC_AgencyCodes' tempTable = r'S:ITGISLizPythonCERRDataPython_CERR.gdbtempTable' Define field variables
  • 16. LOOPING Script has multiple loops •Primary Loop: •Loop through each page using page number for pgNum in range(1, ddp.pageCount + 1): ddp.currentPageID = pgNum •Secondary & Tertiary Loops: •Script loops through scenarios within each page •Search & Insert Cursor •Layout element positioning •if…elif statements with nested for…in statements
  • 17. # Set variables to set data frame insets reportedDistrict = ddp.pageRow.getValue(qMuni_County) newDistrict = ddp.pageRow.getValue(qDistrict) if reportedDistrict == 'City of Grand Junction': lblGrandJunction.elementPositionX = 8.27 lblGrandJunction.elementPositionY = 2.63 lblFruita.elementPositionX = 10.0 lblCollbran.elementPositionX = 10.0 lblDebeque.elementPositionX = 10.0 lblPalisade.elementPositionX = 10.0 lblCounty.elementPositionX = 12.0 txtCounty.elementPositionX = 3.18 txtCounty.elementPositionY = 1.07 txtGrandJunction.elementPositionX = 10.0 txtFruita.elementPositionX = 10.0 txtCollbran.elementPositionX = 10.0 txtDebeque.elementPositionX = 10.0 txtPalisade.elementPositionX = 10.0 for frames in dataframes: if frames.name == 'df_GJT': frames.elementPositionX = 5.7 frames.elementPositionY = 0.5 elif frames.name == 'df_Address': frames.elementPositionX = 0.2745 frames.elementPositionY = 2.9452 else: frames.elementPositionX = 8.8 frames.elementPositionY = 0.7 elif reportedDistrict == ‘Mesa County’:
  • 18. MAP LAYOUT ELEMENTS •Each layout item MUST be uniquely named •Size and Position Tab •Element Name •Create and do preliminary setup in ArcMap then use Python to further manipulate the element
  • 19.
  • 20. SCALE BAR # Set scale bar based on page extent if actDataframe.scale < 4000: scale1.elementPositionX = 0.33 scale1.elementPositionY = 2.98 scale2.elementPositionX = 11.6 scale3.elementPositionX = 11.6 scale4.elementPositionX = 11.6 elif 4001 <= actDataframe.scale <= 10000: scale1.elementPositionX = 11.6 scale2.elementPositionX = 0.33 scale2.elementPositionY = 2.98 scale3.elementPositionX = 11.6 scale4.elementPositionX = 11.6 elif 10001 <= actDataframe.scale <= 20000: scale1.elementPositionX = 11.6 scale2.elementPositionX = 11.6 scale3.elementPositionX = 0.33 scale3.elementPositionY = 2.98 scale4.elementPositionX = 11.6 elif actDataframe.scale > 20001: scale1.elementPositionX = 11.6 scale2.elementPositionX = 11.6 scale3.elementPositionX = 11.6 scale4.elementPositionX = 0.33 scale4.elementPositionY = 2.98 •Create four scale bars in ArcMap •Set Division Value for each •Determine placement on layout •Use Python to change X,Y location based on the scale of the active data frame
  • 21. SEARCH & INSERT CURSORS •Search Cursor •Use For … In… to match record in input table to page variable •Insert Cursor •Populate temporary table with matching records cursor = arcpy.da.SearchCursor(inputTable, ('TAC_Code', 'Year_', 'Agency_Name'), ''' "Year_" = 2013 ''') insertcursor = arcpy.da.InsertCursor(tempTable, ('TAC_Code', 'Year_', 'Agency_Name')) for row in cursor: if row[0] == pgTAC: insertcursor.insertRow(row) del row del insertcursor del cursor cursor = arcpy.da.SearchCursor(inputTable, ('TAC_Code', 'Year_', 'Agency_Name'), ''' "Year_" = 2013 ''') insertcursor = arcpy.da.InsertCursor(tempTable, ('TAC_Code', 'Year_', 'Agency_Name'))
  • 22. DYNAMIC TABLE •Built using Python’s Search and Insert cursors •Lists taxing authorities per challenge address •Verifies that a parcel is located inside or outside of municipal boundary •Based on the number of rows in the table, script will adjust text size, row height, grid line positioning #Set and clone cell text elements cellTxt.fontSize = rowHeight / 0.0155 y = upperY - headerHeight rows = arcpy.SearchCursor("in_memorysort1") for row in rows: x = upperX + 0.05 col1CellTxt = cellTxt.clone("_clone") col1CellTxt.text = row.getValue("Agency_Name") col1CellTxt.elementPositionX = x col1CellTxt.elementPositionY = y col2CellTxt = cellTxt.clone("_clone") col2CellTxt.text = row.getValue("TAC_Code") col2CellTxt.elementPositionX = x + 2.3 col2CellTxt.elementPositionY = y y = y - rowHeight if col1CellTxt.elementWidth > 2: col1CellTxt.elementWidth = 2
  • 23. EXPORT TO PDF # Set Output PDF (Beginning of script) pdfPath = outDir + r"FinalMapBook.pdf" if os.path.exists(pdfPath): # Check to see if file already exists, delete if it does os.remove(pdfPath) finalPdf = arcpy.mapping.PDFDocumentCreate(pdfPath) … # Name and export individual pages (Inside Loop through each page) ddp.exportToPDF(pgLabel + ".pdf", "CURRENT") finalPdf.appendPages(pgLabel + ".pdf") … # Commit Changes and delete variable references (Outside of loop) finalPdf.saveAndClose() del finalPdf
  • 24. THREE HOURS I WAS ABLE TO SPEND WORKING ON SOMETHING ELSE! For batch size between 150 – 200 addresses
  • 25. MOVING FORWARD •Significant time-saver (not counting the time it took to put the script together) •Will continue to work on script •Incorporate intersect and spatial join •Do more with parameters
  • 26. LINKS •DDPwithDynamicTablesAndGraphs_10.1_v1 http://www.arcgis.com/home/item.html?id=3a525b986b774a3f9cbbd8daf2435852 •Merge Excel Workbooks http://msdn.microsoft.com/en-us/library/office/gg549168(v=office.14).aspx •My full script: https://github.com/emcdowell/Python-CERR.git