YouTube | Facebook | X(Twitter) | RSS

空間参照の定義(簡易)

2016/9/1 (木)

Function fncSpatialReference(valType As Long, blnGeographic As Boolean) As ISpatialReference

'DeveloperHelpから以下を参照

'地理座標系(pcsType)
'esriSRGeoCSType Contains
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRGeoCSType.htm
'esriSRGeoCS2Type Constants
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRGeoCS2Type.htm
'esriSRGeoCS3Type Constants
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRGeoCS3Type.htm

'投影座標系(gcsType)
'esriSRProjCSType Constants
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRProjCSType.htm
'esriSRProjCS2Type Constants
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRProjCS2Type.htm
'esriSRProjCS3Type Constants
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRProjCS3Type.htm
'esriSRProjCS4Type Constants
'https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#esriSRProjCS4Type.htm

'例
valType = esriSRProjCS4Type.esriSRProjCS_JGD2000_Japan_Zone_9 'JGD2000 平面直角座標系第9系
valType = esriSRGeoCS3Type.esriSRGeoCS_JapanGeodeticDatum2000 'JGD2000 地理座標系

Dim pSpatialReferenceFactory As ISpatialReferenceFactory
Set pSpatialReferenceFactory = New SpatialReferenceEnvironment

If blnGeographic = True Then
Dim pGeographicCoordinateSystem As IGeographicCoordinateSystem
Set pGeographicCoordinateSystem = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(valType)

Set fncSpatialReference = pGeographicCoordinateSystem

Else
Dim pProjectedCoordinateSystem As IProjectedCoordinateSystem
Set pProjectedCoordinateSystem = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(valType)

Set fncSpatialReference = pProjectedCoordinateSystem
End If

'XY座標精度の設定(9.2以降は設定必須)
Dim pSpatialReferenceResolution As ISpatialReferenceResolution
Set pSpatialReferenceResolution = fncSpatialReference
pSpatialReferenceResolution.SetDefaultXYResolution

'XY許容値の設定(9.2以降は設定必須)
Dim pSpatialReferenceTolerance As ISpatialReferenceTolerance
Set pSpatialReferenceTolerance = fncSpatialReference
pSpatialReferenceToleranceT.SetDefaultXYTolerance

End Function

関連記事

  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

-プログラミング, ArcGIS
-,

WINGFIELD since1981をもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む