Description
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.
Cause
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.
Solution or Workaround
To correct problems due to differences in geographic coordinate systems, the data may need to be transformed to a coordinate system that is compatible with those used by Google Maps and Microsoft Virtual Earth.
If the data are transformed using the information below but the data still do not align correctly, then the data may need to be manually shifted using spatial adjustment tools available in ArcGIS Desktop.
- It is possible to check the geographic coordinate system currently used by the data by opening ArcMap and loading the data layer. Right-click on the layer and click Properties. In the Layer Properties dialog box, select the Source tab. The information should be listed in the Data Source box, in the Geographic coordinate system: line near the bottom of the box.
- If the current geographic coordinate system is WGS 1984 (WGS84), then no transformation is required.
- When a transformation is required, the best performance will be achieved if the data are projected to the new coordinate system. Use the Project tool in ArcGIS Desktop to project data. If the data cannot be projected, then the coordinate system can be set in ArcMap on the data frame. This causes the data to be projected on the fly as it is being served, which degrades performance, but does not require altering the data. See the Desktop Help page on
Specifying a coordinate system for information on setting the data frame coordinate system. - If the current geographic coordinate system is the North American Datum of 1983 (NAD 83) or other GRS80-based GCS, then transformation is probably not required, as the GCS is almost identical to WGS84. If desired, an adjustment can be made. See the instructions below for installations with 9.3 Service Pack 1, or, if SP1 cannot be applied, the instructions for servers without SP1.
- For other geographic coordinate systems, transform the data using the instructions below, either for installations with SP1 or for installations without SP1.
- For ArcGIS Server 9.3 where Service Pack 1 has been applied, the WGS 1984 Web Mercator coordinate system can be used to transform the data. This projection is located in the coordinate systems list under Predefined - Projected Coordinate Systems - World. For best performance, use the Project tool to change the projection of the data set to WGS 1984 Web Mercator. If necessary, the data can be transformed on the fly by setting the coordinate system of the data frame in ArcMap to WGS 1984 Web Mercator. If a datum transformation is required as part of this process, set the 'Into' item for the transformation to GCS_WGS_1984 (i.e., the datum of the data frame). For instructions on setting the data frame coordinate system, see the Desktop Help page on Specifying a coordinate system.
- For servers where version 9.3 Service Pack 1 has not been applied yet, a two-step transformation may be performed using the ArcToolbox Project tool in the Data Management Toolbox. First, transform the data to WGS 1984. For example, if the data are in NAD 1927, first apply NAD_1927_To_WGS_1984_79_CONUS. Second, transform the data using the WGS_1984_Major_Auxiliary_Sphere_To_WGS_1984 transformation.
Alternatively, VBA code can be written to do a composite transformation dynamically in ArcMap. This may allow the data to be served without actually changing it, but be aware that performance may be impacted with dynamic transformations. For example, here is VBA code that may be used to transform data from NAD 1927 to the WGS84 Major Auxiliary Sphere used by the Web Mercator projected coordinate system:
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