From d02ffe26ddcf062ed1fffeef4e60f6be9bb378e2 Mon Sep 17 00:00:00 2001 From: Brian H Wilson Date: Wed, 28 Sep 2022 10:15:54 -0700 Subject: [PATCH] Put python in its own folder, ORMAPTools, and changed make_zip and manifest to match. Updated toolbox. --- .gitignore | 2 + AddDimAnno.py | 104 -------------------------------------- Default.tbx | Bin 176640 -> 176640 bytes UpdateMapIndex.py | 121 --------------------------------------------- UpdateORMAPArea.py | 44 ----------------- make_zip.sh | 4 +- manifest.txt | 4 +- 7 files changed, 5 insertions(+), 274 deletions(-) delete mode 100644 AddDimAnno.py delete mode 100644 UpdateMapIndex.py delete mode 100644 UpdateORMAPArea.py diff --git a/.gitignore b/.gitignore index b6e4761..cb59655 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +ORMAPToolsV* + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/AddDimAnno.py b/AddDimAnno.py deleted file mode 100644 index b72105a..0000000 --- a/AddDimAnno.py +++ /dev/null @@ -1,104 +0,0 @@ -# AddDimAnno.py -# -# Creates dimension annotation from new TaxlotLine Labels using the ConvertLabelsToAnnotation tool. -# -# Tool is run from ArcPro ToolBox/Tool - "CreateDDAnnoFromLabels" in default.tbx -# -# -# Database Required - In local folder TownEd.gdb and Default.gdb -# -# Steps -# 1. Get parameter values -# 2. Set Map Layers and default paths -# 3. Set temporary layers (also make sure they are deleted -# 4. Make Anno from label and append to anno class -# 5. select and update newly added anno -# -# Dean - Spring 2021 - -import arcpy, os - -# 1. Get parameter values -AnnoStyle = arcpy.GetParameterAsText(0) -TaxlotLinesSelected = arcpy.GetParameterAsText(1) -MapIndexCount = arcpy.GetParameterAsText(2) -MapNumber = arcpy.GetParameterAsText(3) -MapScale = arcpy.GetParameterAsText(4) -LabelClass = arcpy.GetParameterAsText(5) -AnnoLayer = arcpy.GetParameterAsText(6) -TaxlotLinesLayer = arcpy.GetParameterAsText(7) -MapIndexLayer = arcpy.GetParameterAsText(8) - -#2. Set Map Layers and default paths - -thisProject = arcpy.mp.ArcGISProject("CURRENT") -Map = thisProject.activeMap -MapIndexLyr = Map.listLayers(MapIndexLayer)[0] -TaxlotLineLyr = Map.listLayers(TaxlotLinesLayer)[0] -AnnoLyr = Map.listLayers(AnnoLayer)[0] -FolderPath = thisProject.homeFolder - -#ScriptPath = os.getcwd() - -OutGDB = FolderPath + "\\TownEd.gdb" -WorkGDB = FolderPath + "\\Default.gdb" - -arcpy.AddMessage (FolderPath) -arcpy.AddMessage (WorkGDB) - -# 3. Set temporary layers (also make sure they are deleted - -AnnoF = "Anno" + str(MapScale) -GroupAnno = "GroupAnno" -AnnoFPth = WorkGDB + "\\Taxlot_lines" + AnnoF -AnnoFLyr = "Taxlot_lines" + AnnoF -annoID = 9 - -arcpy.AddMessage ("AnnoF: " + AnnoF) - -# delete Temp layers - -arcpy.Delete_management (GroupAnno) -arcpy.Delete_management (AnnoFLyr) -arcpy.Delete_management(AnnoFPth) - -# 4. Make Anno from label and append to anno class - -arcpy.cartography.ConvertLabelsToAnnotation('Map', 1200, WorkGDB, AnnoF, 'default', 'ONLY_PLACED', 'NO_REQUIRE_ID', 'STANDARD', '', '', GroupAnno, 'SINGLE_LAYER', TaxlotLineLyr, '', '') - -arcpy.CalculateField_management(AnnoFPth, "SymbolID",0, "PYTHON3") - -arcpy.Append_management(AnnoFLyr, AnnoLyr, "NO_TEST") - -arcpy.AddMessage ("TempMade: " + AnnoFLyr) - -# 5. select and update newly added anno - -arcpy.SelectLayerByAttribute_management(AnnoLyr, "NEW_SELECTION", "SymbolID = 0") - -arcpy.CalculateField_management(AnnoLyr, "SymbolID",annoID, "PYTHON3") -arcpy.CalculateField_management(AnnoLyr, "AnnotationClassID",annoID, "PYTHON3") -arcpy.CalculateField_management(AnnoLyr, "MapNumber","'" + MapNumber + "'", "PYTHON3") - -# Turn Off Labels - -for lblClass in TaxlotLineLyr.listLabelClasses(): - lblClass.visible = False - -# Cleanup temp layers - -arcpy.Delete_management (GroupAnno) -arcpy.Delete_management (AnnoFLyr) -arcpy.Delete_management(AnnoFPth) - - - - - - - - - - - - diff --git a/Default.tbx b/Default.tbx index 46aeca145928f116ed157f5fec6646c7b54af968..51d5bc033aa052ea081b038ef86fd434723c9b27 100644 GIT binary patch delta 273 zcmZp8!qxDEYeNnjn?d05^ytf*i`d#284qs$$zIRI*gLtBtDZ4t^G~kAL~&UL1_pnI zAO>FsM}`1~5Qcmp%wZ_roS)OcBxPZv@0*|El30>zX9Hw}Wag&Y8CaT{8=Fk-(U?6w z?-wK6=2iJFBAZ&$SR`ezo5T<^-B6QBxp_jz_6Z$~nuRzGH82Aix*cd}L-e#TrVdF7 loCY>FFiCG;6~_%q|9yfee+XX5=&C;Y=DfA%-mEvLsMfj6XVG}8ndT2{9wF@@?cIS diff --git a/UpdateMapIndex.py b/UpdateMapIndex.py deleted file mode 100644 index 111e542..0000000 --- a/UpdateMapIndex.py +++ /dev/null @@ -1,121 +0,0 @@ -# Update MapIndex -# This python goes with the UpdateMapIndex Script in the template -# -# In the tool you can enter all the basic map info and it will update it. -# -# You can also adjust many of the parameters to cutomize the tool so that fields like town and range -# will have a pull down list for only those in your township. If you mapindex layer is not Mapindex you -# will need to change the layer name in the tool validation parameters (MapIndexLayer = GetParameterAsText(22) -# -# Tool is run from ArcPro ToolBox/Tool - "UpdateMapIndexReset" in default.tbx -# -# Steps -# 1. Get Values from paramters. -# 2. Get Mapindex layer and ensure only one feature is selected and basic mapnumber parameters are set -# 3. Calc Map Title - Any customization of the map title will go here -# 4. Use update cursor to update selected mapindex feature including ormap numbers -# -# -# Dean - 1/25/2020 -# -# Update: updated to be sure to really exit if more then one map selected - Dean March 2021 - -import sys -import arcpy - -# 1. Get values from parameters ---- - -MapNumber = str(arcpy.GetParameterAsText(0)) -MapScale = arcpy.GetParameterAsText(1) -County = str(arcpy.GetParameterAsText(2)) -ReliaCode = arcpy.GetParameterAsText(3) -Town = str(arcpy.GetParameterAsText(4)) -TownPart = str(arcpy.GetParameterAsText(5)) -TownDir = str(arcpy.GetParameterAsText(6)) -Range = str(arcpy.GetParameterAsText(7)) -RangePart = str(arcpy.GetParameterAsText(8)) -RangeDir = str(arcpy.GetParameterAsText(9)) -Section = str(arcpy.GetParameterAsText(10)) -QuarterSection = str(arcpy.GetParameterAsText(11)) -QtrQtrSection = str(arcpy.GetParameterAsText(12)) -Anomaly = str(arcpy.GetParameterAsText(13)) -MapSuffixType = str(arcpy.GetParameterAsText(14)) -MapSuffixNumber = str(arcpy.GetParameterAsText(15)) -CityName = str(arcpy.GetParameterAsText(16)) -PageName = str(arcpy.GetParameterAsText(17)) -Book = arcpy.GetParameterAsText(18) -GroupName = str(arcpy.GetParameterAsText(19)) -SecondTitle = str(arcpy.GetParameterAsText(20)) -MapAngle = arcpy.GetParameterAsText(21) -MapIndexLayer = str(arcpy.GetParameterAsText(22)) - -arcpy.AddMessage("MapIndex: " + MapIndexLayer) - - -# 2. Set Layer and ensure only 1 feature selected --------------------------- - -thisProject = arcpy.mp.ArcGISProject("CURRENT") -editMap = thisProject.activeMap -MapLayer = editMap.listLayers(MapIndexLayer)[0] - -MapLayerCnt = int(arcpy.GetCount_management(MapLayer).getOutput(0)) -arcpy.AddMessage (MapLayerCnt) - -# Check if you have one map feature selected - if not quit - also check for mapnumber issues (ie. quarter without section) -------------- - -if MapLayerCnt > 1: - arcpy.AddError ("More then one feature selected") - sys.exit(0) -if QuarterSection == "0" and QtrQtrSection != "0": - arcpy.AddError ("Quarter/Quarter is filled but Quarter is not") - sys.exit(0) -if QuarterSection != "0" and Section == "00": - arcpy.AddError ("Cannot have a section 00 with quartersections filled") - sys.exit(0) - -# 3. Calc Map Title----------------------Any county specific code for suffixes etc goes here ---------------------------------------- -# T/R/S does a str/int to get rid of leading zeroes - -QuarterTitles = ['',' N.E.1/4 ',' N.W.1/4 ',' S.W.1/4 ',' S.E.1/4 '] -Quarters = ['0','A','B','C','D'] -Title = "T." + str(int(Town)) + " " + TownDir + ". R." + str(int(Range)) + " " + RangeDir + ". W.M." -if Section != "00": - QuarterTitle = "" - QtrQtrTitle = "" - x = 0 - for q in Quarters: - arcpy.AddMessage(x) - if q == QuarterSection: - QuarterTitle = QuarterTitles[x] - if q == QtrQtrSection: - QtrQtrTitle = QuarterTitles[x] - x = x + 1 - Title = QtrQtrTitle + QuarterTitle + "SEC. " + str(int(Section)) + ' ' + Title - -# 4. Calc Values with UpdateCursor ---------------------------------------------------------------- -# 0 1 2 3 4 5 6 7 8 9 10 11 -with arcpy.da.UpdateCursor(MapLayer,['MapNumber','MapScale','County','ORMapNum','CityName','PageName','Book','GroupName','SecondTitle','ReliaCode','MapAngle',"MapTitle"]) as cursor: - for row in cursor: - row[0] = MapNumber - #if row[1] is None: - row[1] = MapScale - #if row[2] is None: - row[2] = County - row[3] = County + Town + TownPart + TownDir + Range + RangePart + RangeDir + Section + QuarterSection + QtrQtrSection + Anomaly + MapSuffixType + MapSuffixNumber - row[4] = CityName - row[5] = PageName - if Book.isnumeric(): row[6] = Book - row[7] = GroupName - row[8] = SecondTitle - if ReliaCode.isnumeric(): row[9] = ReliaCode - if MapAngle.isnumeric(): row[10] = MapAngle - row[11] = Title - cursor.updateRow(row) -del row - - - - - - - diff --git a/UpdateORMAPArea.py b/UpdateORMAPArea.py deleted file mode 100644 index 8bf0345..0000000 --- a/UpdateORMAPArea.py +++ /dev/null @@ -1,44 +0,0 @@ -# Update Legal Acres -# -# -# Called from UpdateORMAPAreaTool -# -# Uses current project file and layer for Taxlot -# -# For selected taxlots it updates the legal acres needed for ORMAP -# Dean - Spring 2022 -# -import sys -import arcpy - -Taxlot = "Taxlot" - -# 2. Set Layer and ensure only 1 feature selected --------------------------- - -thisProject = arcpy.mp.ArcGISProject("CURRENT") -editMap = thisProject.activeMap -MapLayer = editMap.listLayers(Taxlot)[1] - -MapLayerCnt = int(arcpy.GetCount_management(MapLayer).getOutput(0)) -arcpy.AddMessage (MapLayerCnt) - -# Check if you have one map feature selected - if not quit - also check for mapnumber issues (ie. quarter without section) -------------- - -if MapLayerCnt == 0 or MapLayerCnt > 200: - arcpy.AddError ("Must not have correct number of taxlots selected ") - sys.exit(0) - -arcpy.CalculateField_management(MapLayer, "TaxlotFeet","!CalculatedArea!", "PYTHON3") -arcpy.AddMessage ("TaxlotFeetDone") -arcpy.CalculateField_management(MapLayer, "TaxlotAcre","!CalculatedArea! / 43560", "PYTHON3") -arcpy.AddMessage ("TaxlotAcreDone" ) -arcpy.CalculateField_management(MapLayer, "MapAcres","!Shape_Area! / 43560", "PYTHON3") -arcpy.AddMessage ("MapAcres Done") -arcpy.AddMessage ('Calcs are done') - - - - - - - diff --git a/make_zip.sh b/make_zip.sh index d64e3b5..b45eca7 100644 --- a/make_zip.sh +++ b/make_zip.sh @@ -1,9 +1,9 @@ #!/usr/bin/bash -FOLDER=ORMAPToolsV3.0 +FOLDER=ORMAPToolsV3.0.1 ARCHIVE=$FOLDER.zip rm -f $ARCHIVE mkdir $FOLDER -for item in `cat manifest.txt`; do cp $item ${FOLDER}/; done +for item in `cat manifest.txt`; do cp -r $item ${FOLDER}/; done zip -r $ARCHIVE ${FOLDER} diff --git a/manifest.txt b/manifest.txt index 7aa0205..c91c720 100644 --- a/manifest.txt +++ b/manifest.txt @@ -1,6 +1,4 @@ -AddDimAnno.py Default.tbx ReadMe.txt -UpdateMapIndex.py -UpdateORMAPArea.py manifest.txt +ORMAPTools/