I asked this question in the ESRI forums and got nothing but a lesson on LAS point cloud classifications — not even remotely what I had asked.
I’m hoping someone here can point me in the right direction for this answer. I’ve scoured the internet looking for a solution and the closest I’ve found is from the arcpy.Mapping help page:
There are a few specialized layers and datasets that don't fall into one of these three categories: annotation subclasses, dimension features, network datasets, terrain datasets, topology datasets, and so on.
But, of course, it doesn’t tell you how to handle these specialized layers.
This is my question:
How do I check, with python, if a Terrain Model has pyramids? If it does, then how do I check, with python, if the Terrain Model has data sources already added to build the terrain? Basically, how do I access the Terrain Model Properties to check for... anything really... so that I can verify that they exist or not?
Now for the background:
We are collecting new statewide LiDAR and one of the derived products we distribute is countywide Terrain Models. I have 40 of these to run now and 40 more to run later, all of which have to match the specs of the 20 that have already been run. The less manual hands on time I have to devote to these, the better. So, I've written a script to create these terrain models for me. The intent is to fire this off on 5 computers and walk away for a couple of days.
- Creates a file geodatabase
- Creates a feature dataset and populates it with a hydro breakline layer and a clipping boundary
- Performs a LAS to Multipoint on QL2 LiDAR
- Creates a Terrain
- Adds pyramids to terrain
- Adds data sources to terrain (hydro line, clip bounds, multipoints (embedded))
- Changes the terrain resolution (for hydro breaklines)
- Build terrains.
There are two processes that take a VERY long time:
The first time I ran the script, it failed after 18 hours. It had completed the LAS to Multipoint, created the terrain and added pyramids. It then gave me the following error upon adding data sources to the terrain model.
ExecuteError: Failed to execute. Parameters are not valid. ERROR 000800: The value is not a member of <None> | Shape_Length | Shape_Area. Failed to execute (AddFeatureClassToTerrain).
I stripped the code of everything but the
arcpy.AddFeatureClassToTerrain_3d command and it ran without issue, so I’m not sure what happened there.
The problem is, now I have a terrain that is halfway through the construction process and I don't want to go through the 18 hour LAStoMultipoint->CreateTerrain->AddPyramids all over again.
Yes, I can simply finish the process manually, but I would rather have python check if each step has been completed so I can troubleshoot from where the script broke instead of the beginning. So, for instance, I want python to check for pyramids. If the terrain has pyramids, the script advances to adding data sources. If the terrain model has data sources, the script changes the terrain resolution. And so on.
It is easy to check if something exists with/in feature layers, folders, rasters, and so on—
if not arcpy.Exists or
arcpy.Describe usually does the trick. What is the equivalent for Terrain Model properties?