Select to view content in your preferred language

Adding a feature class to terrain in python

4018
18
03-01-2016 09:38 AM
BethanyMarshall
Deactivated User

Hello all,

I am having a problem with the adding feature classes to the terrain in my python code. I am trying to go from las files to a terrain. The code I am using is listed below:   The LAS_FD is the  Las feature dataset

                   

arcpy.env.workspace = LAS_FD

fcList = arcpy.ListFeatureClasses()

params = "fcList shape mass points <None> 0 48 <none> false <none> <none>"               

print "Adding feature classes to the terrain"

arcpy.AddFeatureClassToTerrain_3d (in_terrain, params)   

Thanks in advance for any help!

Bethany               

0 Kudos
18 Replies
AdrianWelsh
MVP Honored Contributor

Is line 84 this one?

arcpy.AddTerrainPyramidLevel_3d (in_terrain, 'WINDOWSIZE', pyramid_level) 

Maybe try using double quotes instead of single quotes?

0 Kudos
BethanyMarshall
Deactivated User

In ArcGIS, line 84 is this one:

arcpy.AddFeatureClassToTerrain_3d (in_terrain, params)

I am thinking it must be a problem with my params, but I don't know what is wrong.

params = "fcList shape mass points <None> 0 48 <none> false <none> <none>" 

0 Kudos
AdrianWelsh
MVP Honored Contributor

Hmmm, maybe it has to do with the params. Maybe try changing shape to SHAPE and the "<none>" values to "<None>" to stay with the naming conventions. Sometimes Python is picky about upper and lower case.

Though it is possible that the ListFeatureClasses list may be causing the problem too.

I was looking at the example here:

Add Feature Class To Terrain—Help | ArcGIS for Desktop

and it seems that the feature class used for the AddFeatureClassToTerrain_3d is always one feature class versus a list.

0 Kudos
DanPatterson_Retired
MVP Emeritus

The documentation has a lot of preconditions which need to be met and confirmed

as indicated, I would check the documentation that Adrian listed.  Add Feature Class To Terrain—Help | ArcGIS for Desktop Then I would do a manual run through the process in ArcMap (ie not script) using the same inputs as you want to do with your script.  Once that works, you should compare the Results window to your code...in fact you can steal the results window outputs and use it to formulate the base of your code.

0 Kudos
AdrianWelsh
MVP Honored Contributor

Bethany, did you find where the error was happening?

0 Kudos
BethanyMarshall
Deactivated User

I actually changed the shape to SHAPE and the none to None values and I still got the error. I have tried to only input one feature class for the in_feature, but it doesn't seem to make a difference if it is one feature class or a list of feature classes. I have used the arc help, but their code is using a TIN and I am not using a TIN so their inputs are a little different.

I can't seem to figure out what the problem is with my code.

0 Kudos
DanPatterson_Retired
MVP Emeritus

if shape is supposed to refer to the field in a featureclass/shapefile, it would be proper case as in Shape as would None

0 Kudos
AdrianWelsh
MVP Honored Contributor

Dan, that is interesting because the documentation in that link shows it as caps:

However, further down below,  it has Shape like you listed:

That would be nice if it were as easy as a case-sensitive issue... Let's hope!

0 Kudos
DanPatterson_Retired
MVP Emeritus

tHat is sO conFusIng.... mayBe iT WaS caseFrEe DAy