curtvprice

Define Projection fails on a TIN dataset

Discussion created by curtvprice Champion on Oct 24, 2012
Latest reply on May 3, 2017 by klandon

I discovered a problem with TIN coordinate systems when importing a TIN using the LandXML to TIN tool. First the tool did not recognize the current output coordinate system environment, and to boot, the Define Projection tool does not work with TINs.

This problem was verified with 10.0 sp5 and 10.1 SP1.


    • NIM085938  Cannot use Define Projection Tool on TINs.  

 

    • NIM085906  LandXML to TIN tool is not respecting the environment setting for output coordinate system.



Two workarounds were identified:

1. Open the properties of the TIN and then manually define it

2. I wrote a little python function that works around the issue. (You could use this within a Python script, implement this as a script tool, or use it in ModelBuilder inside the Calculate Value tool.)

import os
import shutil
import arcpy

def DefineProjectionForTin(tin,prj):
    # workaround for a bug - define a projection for a TIN
    # 1. Create a temporary raster
    # 2. Define its projection
    # 3. Copy the prj.adf file to the TIN

    wks = os.path.dirname(tin)
    tempGrid = arcpy.CreateScratchName("","","RasterDataset",wks)
    arcpy.CreateRasterDataset_management(wks,
                                         os.path.basename(tempGrid))
    arcpy.DefineProjection_management(tempGrid,dataPrj)
    shutil.copyfile(os.path.join(tempGrid,"prj.adf"),
                    os.path.join(tin,"prj.adf"))
    arcpy.Delete_management(tempGrid)
    return tin

# example usage
#
# Note you could have this be an argument
# to the tool of type "Coordinate System" and
# get it with GetParameterAsText()
#
# dataPrj = arcpy.SpatialReference(102003) # USA Albers CONUS
# DefineProjectionForTin(r"C:\Workspace\tins\bottom_temp1", dataPrj)

Outcomes