Tuesday, 10 October 2017

Importing 3D Analyst functions with ArcPy?


This really seems like I should be able to do this, but I am running into some problems. I want to import 3D Analyst with python, in the same way I import Spatial Analyst, but it returns an error.


For Spatial Analyst I use the following:


from arcpy.sa import *

This allows me to use the spatial analyst functions in python scripts outside of ArcMap. I want to do the same with 3D analyst, but I am running into an error.


I really feel like it should just be:



from arcpy.3D import *

I also tried arcpy.3d, but either way I get the error:


Parsing error : invalid syntax (line 1)

Answer



Spatial Analyst is a module within arcpy which allows the from _ import * syntax. 3D is not a module so you can't import it that way.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...