/OCAMC

OC Automated Map Checking Development Repository

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

OC Automated Map Checking (OCAMC)
Python Programming and Development


AMC Versions

Name Version Date Status Notes
amc13 1.3 2019 Stable Pre-development version - basic functionality
amc14 1.4 2019 Stable Basic version - operates on single boundary parcels
amc15 1.5 2020 Development Adds additional parcel/map processing capabilities for multiple case studies
amc16 1.6 2020 Development Revised cumulative processing capabilities for multiple case studies

Contents



AMC Class Documentation

Class Contents

PART I: AMC CLASS AND INSTANTIATION

  1. AMC Class
  2. Class Instantiation (init)

PART II: MAIN CLASS FUNCTIONS

  1. Base Checks (baseChecks)
  2. Boundary Processing (boundaryProcessing)
  3. Create Legal Description (createLaegalDescription)
  4. Finalize Report (finalizeReport)

PART III: SECONDARY CLASS FUNCTIONS

  1. Append Report (appendReport)
  2. ArcPy Message (getAgpMsg)
  3. Check Project Geodatabase (checkGDB)
  4. Check Layers in CAD (checkLayers)
  5. Create Feature Classes (createFeatureClasses)
  6. Check GPS Control Points (checkGPS)
  7. Check Geodetic Control Geometries (checkGeodeticControls)
  8. Check for POB (checkPOB)
  9. Check for Expanded Boundary Layers (checkEBL)
  10. Check for Closure (checkClosureCentroid)
  11. Check for Location (checkLocation)
  12. Check for Tract Information (checkServerTractMaps)
  13. Check for Parcel Information (checkServerParcelMaps)
  14. Check for Records of Survey Information (checkServerRecordsOfSurvey)
  15. Truncating Values (truncate)
  16. Boundary Course Traverse Path (traverseCourse)
  17. Obtain Next Course Segment (nextCourseSegment)
  18. Correct Boundary Geometry (correctBoundaryGeometry)
  19. Decimal Degrees to Degrees-Minutes-Seconds (dd2dms)
  20. Bearing to Word (bearingLabel)
  21. Map Document Description (describeMapDocument)
  22. Describe Horizontal Controls (describeHorizontalControls)
  23. Format Labels for Bearing and Distance (labelBearingDistance)
  24. Generate CSV Boundary Table (boundaryToTable)



PART I: AMC CLASS AND INSTANTIATION

AMC CLASS

amc(object)
  • This class contains a number of functions, methods, and processes for Automated Map Checking analysis using CAD drawings
  • INPUT/OUTPUT:
    • See class instantiation below.

Class Instantiation

__init__(self, cadpath, prjpath, outpath, cadname, scale, scalefactor, tpob=None, direction=None, tolerance=2)
  • Function class initialization (AMC) that returns an amc class object for further processing.
  • INPUT:
    • cadpath: the file path to the CAD drawing (.dwg).
    • prjpath: the file path to the project directory (that contains the class python code).
    • outpath: the file path to the directory where the execution output and results will be stored.
    • cadname: the name of the CAD drawing (without the file extension).
    • scale: the scale used for the drawing. It can be 'grid' or 'ground'.
    • scalefactor: the single scale conversion factor (from ground to grid and vice versa).
    • tpob (default=None): optional user input that overrides the TPOB point layer in the CAD drawing, or if it does not exist in the CAD drawing.
    • direction (default=None): optional user input defining the direction (clockwise or counter-clockwise) for the boundary course path. When default, the program uses clockwise direction.
    • tolerance (default=2): optional decimal accuracy to check geometry coordinates and against County database. When default, then the accuracy is 1/100th of a foot.
  • OUTPUT:
    • client: an amc class object.
  • NOTES:
    • This function runs on instantiation of a class automatically.



PART II: MAIN CLASS FUNCTIONS

Base Checks

baseChecks(self)
  • Imports the CAD drawing and performs basic layer and geometry checks.
  • Calls the following functions:
    • appendReport()
    • checkGDB()
    • getAgpMsg()
    • checkLayers()
    • createFeatureClasses()
    • checkGPS()
    • checkGeodeticControls()
    • checkPOB()
    • checkEBL()
    • checkLocation()
    • checkServerTractMaps() or checkServerParcelMaps() or checkServerRecordsOfSurvey()
    • traverseCourse()
    • correctBoundaryGeometry()

Boundary Processing

boundaryProcessing(self)
  • This function processes the boundaries of the CAD drawing and performs basic checks. It also processes the boundary multiline features, creates fields in the geodatabase's feature class, mathematically computes bearing, distances, radial angles, etc, for annotation labels and legal descriptions.
  • Calls the following functions:
    • appendReport()
    • truncate()
    • dd2dms()
    • bearingLabel()
  • This function implements a rather complex parcel detection algorithm. The algorithm uses multiple geodatabase operations and queries to determine:

    1. How many parcels are contained in the boundary (V-LINE-PIQ) layer;
    2. The relationship between them (i.e., is there a SINGLE, SEPARATE, NOT-A-PART, etc). This version of the code (v1.6) enables the presence of multiple types of boundary parcels.
    3. Which is the main parcel (largest area) when NOT-A-PART exclusions are present.
    4. The presence and matching of parcels with TPOB points in case of the existence of SEPARATE parcels in the drawing.

    Diagrammatically, the process is shown in the following graph (download PDF file here):

boundaryProcessingAlgorithm


Create Legal Description

createLegalDescription(self)
  • This function generates a legal description document after boundary processing data.

Finalize Report

finalizeReport(self)
  • This function compiles and exports all data and reports, and finishes up the execution.



PART III: SECONDARY CLASS FUNCTIONS

Append Report

appendReport(self, string)
  • Appends the execution report (opened by class instantiation process)
  • INPUT:
    • string: the string text to be appended in the report.

Arcpy Message

getAgpMsg(self, ntabs=1)
  • Obtains and returns the message(s) generated by the execution of arcpy functions.
  • ntabs: how many tabs to insert at the beginning of the message (to be used in the execution report)

Check Project Geodatabase

checkGDB(self)
  • Checks if the reference geodatabase exists. If it does, it deletes it and creates a new one.
  • Calls the following secondary functions:
    • appendReport()

Check Layers in CAD

checkLayers(self)
  • Checks for the presence of all the layers in CAD drawing. Records Pass/Fail in JSON Checks.
  • Checking for layers:
    • V-ANNO: Annotation layer to be used for all Text, Mtest, Leaders, Multileaders and Dimensions (continuous line type)
    • V-LINE: Miscellaneous lines layer to be used for any lines do not fit in the template layer format (continous line type)
    • V-LINE-CALC: Line Calc. Layer to be used for any line work shown for graphical purposes only (continous line type)
    • V-LINE-CNTR: Street established centerline layer (CENTER2 line type)
    • V-LINE-ESMT: Easement layer (DASHED2 line type)
    • V-LINE-LOTS: Property line layer to be used for the established property in question line work (continuous line type)
    • V-LINE-PCLS: GIS parcel lines and parcel annotation layer (DASHED line type)
    • V-LINE-PIQ-PARCEL: PIQ parcel lines layer to be used only for the created parcels which represent the established property in question line work (continous line type)
    • V-LINE-REF: Line reference layer to be used for the referenced lines (HIDDEN2 line type)
    • V-LINE-ROW-PARCEL: ROW parcel lines layer to be used only for the created parcels which represent the established right-of-way line work (continuous line type)
    • V-LINE-RTWY: Street ROW layer to be used only for the right-of-way line work (continuous line type)
    • V-LINE-TIE: Ties to basis of bearing layer (DASHED2 line type)
    • V-MISC: North arrow layer (continuous line type)
    • V-NODE-MON: Monuments layer (continuous line type)
    • V-NODE-TABL: Table data layer for points (continous line type)
    • V-NODE-TPOB: True point of beginning layer to be used only for the point of beginning which was used to create the parcel of the property (continuous line type)
    • V-SHEET: Sheet details layer to be used for the line and curve tables (continuous line type)
    • V-TBLE-LINE:Table annotation layer to be used for the line and curve tables (continuous line type)
    • V-VPORT Freezes 1: V-VPORT freezes 1 layer to be used to control viewport freeze (continuous line type)
    • V-VPORT Freezes 2: V-VPORT freezes 2 layer to be used to control viewport freeze (DASHED2 line type)
  • Calls the following secondary functions:
    • appendReport()

Create Feature Classes

createFeatureClasses(self)
  • Creates feature classes from original CAD drawing layers. Uses specific and verified layers from the imported CAD drawing features to generate feature classes in the geodatabase.
  • Calls the following secondary functions:
    • appendReport()
    • checkClosureCentroid()

Check GPS Control Points

checkGPS(self)
  • Checks and verifies the presence of the GPS control points in the CAD drawing
  • Calls the following secondary functions:
    • appendReport()

Check Geodetic Control Point Geometries

checkGeodeticControls(self)
  • Checks for geodetic control point geometries in server geodatabase.
  • Calls the following secondary functions:
    • appendReport()

Check for POB

checkPOB(self)
  • Checks for the presence of the (True) point of beginning, either by the user, or in the CAD drawing.
  • Calls the following secondary functions:
    • appendReport()

Check for Expanded Boundary Layers

checkEBL(self)
  • CHecking for expanded boundary layers in CAD drawing and corrects geometry if necessary.
  • Calls the following secondary functions:
    • appendReport()

Check for Closure

checkClosureCentroid(self)
  • Checks for closure: creating boundary polygon and returns it's centroid coordinates.
  • Calls the following secondary functions:
    • appendReport()

Check for Location

checkLocation(self)
  • Checking County server geodatabase for location data on tract/parcel.
  • Calls the following secondary functions:
    • appendReport()

Check for Tract Information

checkServerTractMaps(self)
  • Checks for Tract information from server geodatabase.
  • Calls the following secondary functions:
    • appendReport()

Check for Parcel Information

checkServerParcelMaps(self)
  • Checks for Parcel information from server geodatabase.
  • Calls the following secondary functions:
    • appendReport()

Check for Records of Survey Information

checkServerRecordsOfSurvey(self)
  • CHecks for Record of Survey information from server geodatabase.
  • Calls the following secondary functions:
    • appendReport()

Boundary Course Traverse Path

traverseCourse(self)
  • Obtains the course and order for the boundary traverse path over multilines (PIQ).
  • Calls the following secondary functions:
    • appendReport()
    • truncate()
    • nextCourseSegment()

Truncating Values

truncate(self, v, n)
  • Truncates coordinates a the n-th decimal places, for the value v(double).

Obtain Next Course Segment

nextCourseSegment(self, course, segments)
  • Gets the next course coordinate based on the initial line (course[1]), and the line segment coordinates from ArcGIS Boundary feature class (PIQ). Returns a JSON string indexed by the order ID (the order to which the lines are added to the course), and for each item, the Boundary feature class OBJECTID, its true start and end coordinates (reversed from the feature class line direction if needed - always clockwise).

Correct Boundary Geometry

correctBoundaryGeometry(self)
  • Checks and corrects (if needed) the boundary course geometry given a course and a direction (clockwise or counter-clockwise). The function checks the start and end endpoints and if need reversing it updating the featur class's multiline geometry in the geodatabase.
  • Calls the following secondary functions:
    • appendReport()

Decimal Degrees to Degrees-Minutes-Seconds

dd2dms(self, dd)
  • Returns formatted coordinates of the Degrees:Minutes:Seconds format. This secondary function restructures decimal degree coordinates into degree/minutes/seconds coordinats. It is called from the main module function.

Bearing to Word

bearingLabel(self, bearing)
  • Returns the corresponding direction word based on radial bearing values

Map Document Description

describeMapDocument(self)
  • Generates a description of the map document

Describe Horizontal Controls

describeHorizontal Controls(self)
  • Obtains and generates the Preamp description from horizontal geodetic controls to the point of beginning.

Format Labels for Bearing and Distance

labelBearingDistance(self, bearing, distance)
  • Generates a formatted bearing and distance string from coordinates

Generate CSV Boundary Table

boundaryToTable(self)
  • Creates a csv-formatted boundary table containing the course data



Classes and Execution Code in Folders

Python Classes and Functions

Execution Code



Folders and Python Classes