How do I add a TIN to ArcMap using Python?

1500
1
02-01-2017 08:33 AM
KC
by
Occasional Contributor

We have a number of TINs covering our county and I would like to do a hyperlink script for the index layer to add the appropriate TIN to the Table of Contents when a feature is clicked with the hyperlink tool.

However, I'm having no luck finding the correct Python code to make this happen:  Testing with variations of "add a [****]" code I get arcpy.mapping.Layer erroring with "invalid data source", arcpy.MakeFeatureLayer_management says "Dataset does not exist or is not supported", etc.

Sample code where it errors on the last line:

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
tinpath = r"\\here\thar\be\TINs"
arcpy.env.workspace = tinpath
tin = arcpy.ListDatasets("tin*", "Tin")[0]
arcpy.MakeFeatureLayer_management(tin, "tin1")

Thanks!

Tags (3)
0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

list datasets will just do that ListDatasets—Help | ArcGIS Desktop 

and the arcpy.mapping module's functions are

Alphabetical list of arcpy.mapping functions—Help | ArcGIS Desktop 

The closest seems to be reference to 'edges' in  ListFeatureClasses—Help | ArcGIS Desktop 

which seems to provide a disconnect between what you want to do and what you can... unless you have layer files (ie ... *.lyr )

I will move this to https://community.esri.com/community/gis/3d?sr=search&searchId=bc9bd0fe-7345-4abf-bde3-e35a74632ea1&...‌ to see if anyone over there has a process to do what you want

0 Kudos