更改 Terrain 参考比例 (3D Analyst)

摘要

更改与 terrain 金字塔等级相关联的参考比例。

用法

语法

ChangeTerrainReferenceScale_3d (in_terrain, old_refscale, new_refscale)
参数说明数据类型
in_terrain

The input terrain dataset.

Terrain Layer
old_refscale

现有金字塔等级的参考比例。

Long
new_refscale

金字塔等级的新参考比例。

Long

代码示例

ChangeTerrainReferenceScale 示例 1(Python 窗口)

The following sample demonstrates the use of this tool in the Python window:

import arcpy
from arcpy import env

arcpy.CheckOutExtension('3D')
env.workspace = 'C:/data'
arcpy.ChangeTerrainReferenceScale_3d('terrain.gdb/terrainFDS/terrain1', 
                                   1000, 2000)
ChangeTerrainReferenceScale 示例 2(独立脚本)

The following sample demonstrates the use of this tool in a stand-alone Python script:

'''****************************************************************************
Name: Update Terrain
Description: This script demonstrates how to update a terrain dataset 
             with new elevation measurements obtained from Lidar by
             importing LAS files to multipoint features, then appending the
             new points to another multipoint feature that participates in a
             terrain. The terrain's pyramids are modified to optimize its 
             draw speed.
****************************************************************************'''
# Import system modules
import arcpy
from arcpy import env
import exceptions, sys, traceback

try:
    arcpy.CheckOutExtension("3D")
    
    # Set environment settings
    env.workspace = "C:/data"

    # Set Variables
    inTerrain = "sample.gdb/featuredataset/terrain"
    currentPts = "existing_points"
    lasFiles = ['las/NE_Philly.las',
                'las/NW_Philly.las']
    newPts = 'in_memory/update_pts'
    # Define spatial reference of LAS files using factory code
    # for NAD_1983_StatePlane_Pennsylvania_South
    lasSR = arcpy.SpatialReference()
    lasSR.factoryCode = 2272
    lasSR.create()
    
    arcpy.AddMessage("Converting LAS files to multipoint features...")
    arcpy.ddd.LASToMultipoint(lasFiles, newPts, 1.5, 2, 1, 
                              'INTENSITY', lasSR)
    
    arcpy.AddMessage("Appending LAS points to {0}..."\
                     .format(currentPts))
    arcpy.AppendTerrainPoints_3d(inTerrain, currentPts, newPts)
    
    arcpy.AddMessage("Changing terrain pyramid reference scales...")
    arcpy.ddd.ChangeTerrainReferenceScale(inTerrain, 1000, 500)
    arcpy.ddd.ChangeTerrainReferenceScale(inTerrain, 2500, 2000)
    
    arcpy.AddMessage("Adding terrain pyramid level...")
    arcpy.ddd.AddTerrainPyramidLevel(inTerrain, "", "4 4500")
    
    arcpy.AddMessage("Changing pyramid resolution bounds for breaklines...")
    arcpy.ChangeTerrainResolutionBounds_3d(inTerrain, "breaklines", 5, 4)
    
    arcpy.AddMessage("Building terrain...")
    arcpy.ddd.BuildTerrain(inTerrain)
    
    arcpy.AddMessage("Completed updates.")

except arcpy.ExecuteError:
    print arcpy.GetMessages()
except:
    # Get the traceback object
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    # Concatenate error information into message string
    pymsg = "PYTHON ERRORS:\nTraceback info:\n{0}\nError Info:\n{1}"\
          .format(tbinfo, str(sys.exc_info()[1]))
    msgs = "ArcPy ERRORS:\n {0}\n".format(arcpy.GetMessages(2))
    # Return python error messages for script tool or Python Window
    arcpy.AddError(pymsg)
    arcpy.AddError(msgs)

finally:
    arcpy.CheckInExtension("3D")

环境

相关主题

许可信息

ArcView: 需要 3D Analyst
ArcEditor: 需要 3D Analyst
ArcInfo: 需要 3D Analyst

7/10/2012