AnsweredAssumed Answered

3D Basemaps Solution running outside of ArcGIS

Question asked by cernak_kam on Jul 10, 2020

Hello,

 

I would like to run the tool Extract Roof Form in Jupyter Notebook, but since the city is divided in several parts, it would be nice to send the data into a 'for' loop. When I am trying to import the CreateBuildings toolbox, I am getting the following errors:

 

NameError: name 'Nil' is not defined

IndexError: list index out of range

However, at the end, it seems like the toolbox is imported:

<module 'CreateBuildings'>

Then I tried to run the tool and I got the following error: 

 

OSError                                   Traceback (most recent call last)~\Documents\ArcGIS\Packages\3Dbasemaps_8ee4ba\p20\extract_roof_form_tbx.py in <module>      2 from scripts import extract_roof_form      3 ----> 4 aprx = arcpy.mp.ArcGISProject("CURRENT")      5 home_directory = aprx.homeFolder      6 project_ws = aprx.defaultGeodatabase C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py in __init__(self, aprx_path)    335            A string that includes the full system path and file name of an existing ArcGIS project ( .aprx ) or a string that contains the CURRENT keyword."""    336         import arcgisscripting--> 337         self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True))    338     339 class Bookmark(_ObjectWithoutInitCall):OSError: CURRENT 
---------------------------------------------------------------------------ExecuteError                              Traceback (most recent call last)<ipython-input-7-3a4f66b71178> in <module>      7                                       False, 0.05, False,      8                                       "blds_bosonohy_footprint",----> 9                                       False)~\Documents\ArcGIS\Packages\3Dbasemaps_8ee4ba\p20\CreateBuildings.tbx in ExtractRoofForm(Buildings, DSM, DTM, nDSM, Create_Flat_Roofs_Only, Minimum_Flat_Roof_Area, Minimum_Slope_Roof_Area, Minimum_Roof_Height, Output_Building_Polygons, Simplify_Buildings, Simplify_Tolerance, first_time, previous_layer, first_time_dsm)    159     160             if sr.VCS:--> 161                 cs_vcs_name = sr.VCS.name    162     163         failed = False~\Documents\ArcGIS\Packages\3Dbasemaps_8ee4ba\p20\CreateBuildings.tbx in ExtractRoofForm(Buildings, DSM, DTM, nDSM, Create_Flat_Roofs_Only, Minimum_Flat_Roof_Area, Minimum_Slope_Roof_Area, Minimum_Roof_Height, Output_Building_Polygons, Simplify_Buildings, Simplify_Tolerance, first_time, previous_layer, first_time_dsm)    156                 projected = True    157             else:--> 158                 projected = False    159     160             if sr.VCS:C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py in <lambda>(*args)    509         val = getattr(self._gp, attr)    510         if callable(val):--> 511             return lambda *args: val(*gp_fixargs(args, True))    512         else:    513             return convertArcObjectToPythonObject(val)ExecuteError: ERROR 000582: Error occurred during execution.

From the message I didn't find a solution for my problem. When I run the tool in ArcGIS Pro everything is okay. I tried to set up task schedule for the areas, but I got the same error as in Jupyter Notebook:

Traceback (most recent call last):   File "C:\Users\tcernak\Documents\ArcGIS\Packages\3Dbasemaps_8ee4ba\p20\extract_roof_form_tbx.py", line 4, in <module>     aprx = arcpy.mp.ArcGISProject("CURRENT")   File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\_mp.py", line 337, in __init__     self._arc_object = arcgisscripting._mapping.ArcGISProject(*gp_fixargs((aprx_path,), True)) OSError: CURRENT
Failed to execute (ExtractRoofForm).

 

Is it possible to run the tool outside of ArcGIS Pro somehow, please?

 

PS: I realized another problem - when I try to run the tool from default location on the C: drive (where the package is unpacked) it goes well. However, when I try to run the tool from selected location, it fails. Why?

Outcomes