Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Given a FGDB of Datasets containing parcel polygons
- # This script will:
- # Dissolve all of the parcel polygons
- # Merge those results
- # Dissolve the results again
- #
- # This creates a polygon showing at a state level what areas are covered by the polygons
- # Import modules
- import arcpy
- from arcpy import env
- import os
- # Setup variables
- arcpy.env.overwriteOutput = True
- ##########------ CHANGE THIS ----- ##################
- #####################################################
- # ----- INPUT GeoDatabase Location
- dbRoot = r"\fema.netr2GroupsGISGIS_SHAREData_StaticNJParcelsNew_Jersey.gdb"
- # ----- Output Path
- outPath = r"\fema.netr2GroupsGISGIS_SHAREData_StaticNJParcels"
- #####################################################
- arcpy.env.workspace = dbRoot
- # ----- Output naming suffix to append
- suffix = "_dissolve"
- print "Working in Workspace: " + arcpy.env.workspace
- # Iterate through the feature datasets
- fdlist = arcpy.ListDatasets()
- for fd in fdlist:
- print "Processing Dataset ", fd
- arcpy.env.workspace = dbRoot + "/" + fd
- print "New Workspace: " + arcpy.env.workspace
- # Iterate through the feature classes
- fclist = arcpy.ListFeatureClasses()
- for fc in fclist:
- print "Processing FC ", fc
- desc = arcpy.Describe(fc)
- if desc.shapeType == "Polygon":
- outFeatureClass = outPath + fc + suffix
- print "Dissolving to ", outFeatureClass
- arcpy.Dissolve_management(fc, outFeatureClass, dissolve_field="",
- statistics_fields="", multi_part="MULTI_PART",
- unsplit_lines="DISSOLVE_LINES")
- print "Diossolves complete."
- # Iterate through the feature classes and merge
- arcpy.env.workspace = dbRoot
- mergeOut = dbRoot + "/AllMerged"
- fclist = arcpy.ListFeatureClasses()
- print "Merging to " + mergeOut
- arcpy.Merge_management(inputs=fclist, output=mergeOut)
- # Disolve Results
- finalDissolve = mergeOut + "ParcelCoverage"
- print "Final Dissolve: " + finalDissolve
- arcpy.Dissolve_management(mergeOut, finalDissolve, dissolve_field="",
- statistics_fields="", multi_part="MULTI_PART",
- unsplit_lines="DISSOLVE_LINES")
- print "Done."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement