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.

The script:

  1. Creates a file geodatabase
  2. Creates a feature dataset and populates it with a hydro breakline layer and a clipping boundary
  3. Performs a LAS to Multipoint on QL2 LiDAR
  4. Creates a Terrain
  5. Adds pyramids to terrain
  6. Adds data sources to terrain (hydro line, clip bounds, multipoints (embedded))
  7. Changes the terrain resolution (for hydro breaklines)
  8. Build terrains.

There are two processes that take a VERY long time: LASToMultipoint_3d and BuildTerrain_3d.

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?

  • Can't you use the skip_existing parameter in arcpy.BuildPyramids_management() to not build pyramids for the rasters that already have them? The other workaround that I've used is to check for the presence of .ovr files, though this doesn't work with geodatabase rasters. – dmahr May 27 '15 at 13:15
  • I wish it were that simple. 'skip_existing' is a parameter for the creation of RASTER pyramids. I'm working with a Terrain Dataset. Terrains are stored in geodatabases and therefore don't have an external pyramid file. – NCFMP May 27 '15 at 16:02
  • The more I scour the web for a solution to this problem, the more I'm beginning to believe that this will not be solved with python alone but with the comtypes module and ArcObjects. I know nothing about either. If someone knows a good learning source, I'd appreciate it. Esri's ArcObjects Resource Center is not very helpful. – NCFMP May 28 '15 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.