Select to view content in your preferred language

Define Projection fails on a TIN dataset

5899
4
10-24-2012 09:12 AM
curtvprice
MVP Esteemed Contributor

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)
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
4 Replies
JeffreySwain
Esri Regular Contributor
Thanks for the update.  Hopefully we will see these issues addressed soon.  I am sorry that I was not able to come up with a more 'code' friendly workaround.  If the environment setting is taken than it should not be a problem with your workflow any longer. I encourage any user that is having a specific issue or experiencing a problem to create an Incident with Esri Support. Then we can work towards a solution, explain a workflow or as in this case report the problem so it can be addressed.
0 Kudos
KyleLandon
Occasional Contributor

Dang, this still hasn't been fixed.

0 Kudos
curtvprice
MVP Esteemed Contributor

I debugged my function. For the good of the thread, can you describe the details of your workflow that is not, uh, working?

0 Kudos
KyleLandon
Occasional Contributor
  1. Create Civil 3D (TIN) Surface 
  2. Export to LandXML (Verified that a projection is defined in the LandXML file)
  3. Run LandXML to TIN tool in GIS (tried both ArcGIS Pro and ArcMap)
  4. TIN produced does not have a projection defined.
  5. Define Projection tool does not work (tried both ArcGIS Pro and ArcMap).
  6. End up assigning using ArcCatalog (right click on TIN in Catalog Tree ->Properties -> XY Coordinate System)
0 Kudos