|
引用这个帖子,但在10.0中运行错误,不知怎么修改一下:
http://bbs.3s001.com/forum.php?mod=viewthread&tid=46298
代码如下:
'=========================
'shape_Get_X_Min.cal
'Author: Ianko Tchoukanski
'http://www.ian-ko.com
'=========================
Dim pMxDoc As IMxDocument
Dim pGeometry As IGeometry
Dim pMap As IMap
Dim pEnvelope As IEnvelope
Dim dXMin As Double
Dim bSrefFromMap As Boolean
'=======================
'Adjust the parameter below
'bSrefFromMap = True ==> the coordinates will be calculated in the projection of the Map
'bSrefFromMap = False ==> the coordinates will be calculated in the projection of the data
bSrefFromMap = True
'=======================
If (Not IsNull([Shape])) Then
Set pGeometry = [Shape]
If (Not pGeometry.IsEmpty) Then
If (bSrefFromMap) Then
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
pGeometry.Project pMap.SpatialReference
End If
Set pEnvelope = pGeometry.Envelope
dXMin = pEnvelope.LowerLeft.X
End If
End If
__esri_field_calculator_splitter__
dXMin
|
|