pturner

Define coordinate system for TINs using arcpy

Discussion created by pturner on Sep 22, 2011
Latest reply on May 3, 2017 by curtvprice
ArcGIS 10.0 SP2 Build 3200, Windows 7, 64bit.

Question 1: Using arcpy, how do I get the current coordinate system of a TIN?
Question 2: Using arcpy, how do I set the coordinate system of a TIN?

I have a zillion TINs all without a defined geographic coordinate system. I need to loop over each TIN and define the coordinate system to be WGS84 and I can't seem to find the magic in arcpy to accomplish this. I can set the coordinate system to WGS84 through the GUI one at a time, I should live so long as to accomplish this using the GUI.

The error I get is:

000289 : Failed to alter spatial reference.
ArcGIS 10
Description
The spatial reference of the dataset cannot be altered. The dataset may be in use by another application and therefore locked.

Solution
Ensure that the dataset is not read-only or being locked by another application or user


The data set is not open as near as I can tell.

Here is the script as would work on a single TIN:

import arcpy
# coordinateSystem = "C:/Program Files (x86)/ArcGIS/Desktop10.0/Coordinate Systems/Geographic Coordinate Systems/World/WGS 1984.prj"
coordinateSystem = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
tin = "habop-1999-04-avgcombinedSVT"
wdir = "c:/path/TINS"
arcpy.env.workspace = wdir
desc = arcpy.Describe(tin)
try:
    d = arcpy.DefineProjection_management(tin, coordinateSystem)
except:
    print tin+" conversion no good."


Thanks a heap in advance,

--Paul

Outcomes