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.)
<SPAN class="keyword token">import</SPAN> os
<SPAN class="keyword token">import</SPAN> shutil
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">DefineProjectionForTin</SPAN><SPAN class="punctuation token">(</SPAN>tin<SPAN class="punctuation token">,</SPAN>prj<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token"># workaround for a bug - define a projection for a TIN</SPAN>
<SPAN class="comment token"># 1. Create a temporary raster</SPAN>
<SPAN class="comment token"># 2. Define its projection</SPAN>
<SPAN class="comment token"># 3. Copy the prj.adf file to the TIN</SPAN>
wks <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>dirname<SPAN class="punctuation token">(</SPAN>tin<SPAN class="punctuation token">)</SPAN>
tempGrid <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CreateScratchName<SPAN class="punctuation token">(</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">"RasterDataset"</SPAN><SPAN class="punctuation token">,</SPAN>wks<SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CreateRasterDataset_management<SPAN class="punctuation token">(</SPAN>wks<SPAN class="punctuation token">,</SPAN>
os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>basename<SPAN class="punctuation token">(</SPAN>tempGrid<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>DefineProjection_management<SPAN class="punctuation token">(</SPAN>tempGrid<SPAN class="punctuation token">,</SPAN>dataPrj<SPAN class="punctuation token">)</SPAN>
shutil<SPAN class="punctuation token">.</SPAN>copyfile<SPAN class="punctuation token">(</SPAN>os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>tempGrid<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"prj.adf"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN>
os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>tin<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"prj.adf"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>Delete_management<SPAN class="punctuation token">(</SPAN>tempGrid<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">return</SPAN> tin
<SPAN class="comment token"># example usage</SPAN>
<SPAN class="comment token"># </SPAN>
<SPAN class="comment token"># Note you could have this be an argument</SPAN>
<SPAN class="comment token"># to the tool of type "Coordinate System" and</SPAN>
<SPAN class="comment token"># get it with GetParameterAsText()</SPAN>
<SPAN class="comment token"># </SPAN>
<SPAN class="comment token"># dataPrj = arcpy.SpatialReference(102003) # USA Albers CONUS</SPAN>
<SPAN class="comment token"># DefineProjectionForTin(r"C:\Workspace\tins\bottom_temp1", dataPrj)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>