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
空間参照の定義(簡易)
2016/9/1 (木)