PROBLEM
Spatial features from ArcGIS Server may not align correctly with the maps in Google Maps or Microsoft Virtual Earth when overlaid using the ESRI JavaScript extensions.
The cause may be geographic (datum) transformation issues. These issues are usually most evident at the local scale, such as a local street map.
Google Maps and Microsoft Virtual Earth use a Mercator projection based on the World Geodetic System (WGS) 1984 geographic coordinate system (datum). This Mercator projection supports spheres only, unlike the ESRI Mercator implementation, which supports spheres and ellipsoids. To emulate the sphere-only Mercator, it is necessary to use a sphere-based geographic coordinate system (GCS) to use the correct Mercator equations. This sphere-based geographic coordinate system is called 'WGS 1984 Major Auxiliary Sphere'. A WGS 1984 Web Mercator projected coordinate system and the WGS 1984 Major Auxiliary Sphere geographic coordinate system are included in ArcGIS version 9.3.
If the data are based on a different geographic coordinate system, such as the North American Datum of 1927 (NAD27), ED 50, Amersfoort, or Tokyo; then misalignment may be quite noticeable at the local scale. Data in the North American Datum of 1983 (NAD83), WGS 1984, or another geographic coordinate system (GCS) that use the GRS80 ellipsoid are usually close enough to align without correction.
Code:
' Note: The transformations in this code are supported at version 9.3. They are not supported in 9.2.
' Start by getting a handle on the current FocusMap
Dim pActiveView As IActiveView
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
Set pActiveView = pMxDoc.ActiveView
'1)Create our factory
Dim pSpatRefFact As ISpatialReferenceFactory2
Set pSpatRefFact = New SpatialReferenceEnvironment
Dim pGeoTrans_A As IGeoTransformation
Dim pGeoTrans_B As IGeoTransformation
'2)Use the factory to create our geotransformation objects
Set pGeoTrans_A = _
pSpatRefFact.CreateGeoTransformation(esriSRGeoTransformation_NAD_1927_To_WGS_1984_79_CONUS) ' 15851 NAD27 to WGS84 using NADCON
Set pGeoTrans_B = pSpatRefFact.CreateGeoTransformation(108100) ' WGS84 Maj Aux Sphere to WGS84
'3)Create a composite geotransformation object
Dim pGeoTransComposite As ICompositeGeoTransformation
Set pGeoTransComposite = New CompositeGeoTransformation
'4)Add the two separate geotransformations to the composite
pGeoTransComposite.Add esriTransformForward, pGeoTrans_A ' NAD27 to WGS84
pGeoTransComposite.Add esriTransformReverse, pGeoTrans_B ' Sphere to WGS84, reversed
'5)Give the new transformation a name.
Dim pNewGeoTrans As IGeoTransformation
Set pNewGeoTrans = pGeoTransComposite
pNewGeoTrans.Name = "NAD27_To_Web_Sphere"
'6)QI for the IMapGeographicTransformations
Dim pMapGeotrans As IMapGeographicTransformations
Set pMapGeotrans = pMap
'7)And get the IGeoTransformationOperationSet
Dim pGeoTransOperationSet As IGeoTransformationOperationSet
Set pGeoTransOperationSet = pMapGeotrans.GeographicTransformations
'8)Add our composite to the set
'This adds two transformations from NAD27 to WGS84 Sphere and back
pGeoTransOperationSet.Set esriTransformForward, pGeoTransComposite
pGeoTransOperationSet.Set esriTransformReverse, pGeoTransComposite
pActiveView.Refresh
Article ID: 000009982
Get help from ArcGIS experts
Download the Esri Support App
You can also download the app to access the chatbot anytime! Download it now.