|
42 | 42 | feature_name = arcpy.GetParameterAsText(3) |
43 | 43 | coord_syst = arcpy.GetParameterAsText(4) |
44 | 44 |
|
45 | | -sr = arcpy.SpatialReference() |
46 | | -sr.loadFromString(coord_syst) |
47 | | -output_proj = sr.PCSCode |
| 45 | +output_spatial_ref = arcpy.SpatialReference() |
| 46 | +output_spatial_ref.loadFromString(coord_syst) |
| 47 | +output_proj = output_spatial_ref.PCSCode |
48 | 48 |
|
49 | 49 | corner_name = feature_name + "_CORNER" |
50 | 50 | wall_name = feature_name + "_WALL" |
|
124 | 124 | status_field = None |
125 | 125 |
|
126 | 126 | ############## GET INPUT PROJECTIONS #################### |
127 | | -building_proj = Utils_arcpy.getProjCodeFromFC(building_polys_fl) |
128 | | -excavation_proj = Utils_arcpy.getProjCodeFromFC(excavation_polys_fl) |
| 127 | +building_spatial_ref = arcpy.Describe(building_polys_fl).spatialReference |
| 128 | +excavation_spatial_ref = arcpy.Describe(excavation_polys_fl).spatialReference |
129 | 129 |
|
130 | 130 | ### GET EXCAVATION ANS BUILDINGS ON SAME PROJECTION ##### |
131 | 131 | excavation_polys_matched = False |
132 | | -if excavation_proj != building_proj: |
| 132 | +if excavation_spatial_ref != building_spatial_ref: |
133 | 133 | arcpy.AddMessage("Matching input projections before clip..") |
134 | 134 | excavation_polys_matched = output_folder + os.sep + "exc_match.shp" |
135 | | - arcpy.Project_management(excavation_polys_fl, excavation_polys_matched, building_proj) |
| 135 | + arcpy.Project_management(excavation_polys_fl, excavation_polys_matched, building_spatial_ref) |
136 | 136 | excavation_polys_fl = excavation_polys_matched |
137 | 137 |
|
138 | 138 | ################ GET EXCAVATION INFO ##################### |
139 | 139 | excavation_outline_as_json = Utils_arcpy.getConstructionAsJson(excavation_polys_fl) |
140 | | -buildingsClipExtent = Utils_arcpy.getBuildingsClipExtentFromConstruction(excavation_outline_as_json, CALCULATION_RANGE, building_proj, logger) |
| 140 | +buildingsClipExtent = Utils_arcpy.getBuildingsClipExtentFromConstruction(excavation_outline_as_json, CALCULATION_RANGE, building_spatial_ref, logger) |
141 | 141 |
|
142 | 142 | ################ EXTRACTING BUILDINGS ################## |
143 | 143 | buildings_clip = output_folder + os.sep + "buildings_clip.shp" |
|
152 | 152 | excavation_polys_projected = False |
153 | 153 | buildings_clip_projected = False |
154 | 154 |
|
155 | | -if building_proj != output_proj: |
| 155 | +if building_spatial_ref != output_spatial_ref: |
156 | 156 |
|
157 | 157 | arcpy.AddMessage("Projecting bulidings polygon..") |
158 | 158 | buildings_clip_projected = output_folder + os.sep + "buil_proj.shp" |
|
0 commit comments