Why are my OGC® Web Services displaced by about 120 metres?

You add your British National Grid data to a new Map Document in ArcMap and publish it to ArcGIS Server, ticking the Web Map Service (WMS) box, getting no errors and all is well; you even add the WMS to another Map Document  and everything matches perfectly.  Later when the user - you know the one who always finds things which go wrong - adds the WMS to their mash-up they call you and inform you that the map is shifted about 120 metres.  Sound familiar?

So you curse, kick the server (not literally, I hope) and get on the phone to Support to complain about a bug in the software.  Unfortunately the bug is not in the software, the omission is in the OGC® WMS Specification and potentially affects all WMS, WFS, WCS (in fact any W*S) Services. 

The user who reported the problem is not using British National Grid (BNG) as the Coordinate Reference System (CRS) of their map but something based on a different datum to GCS_OSGB_1936, which BNG is based upon, such as GCS_WGS_1984 or a projection based on a different datum such as WGS 1984 Web Mercator Auxiliary Sphere.  And the reason why the map is shifted is because no Geodetic Datum Transformation (GDT) has been applied to the published Map Document (see this blog entry for information about transformations).  But why would you expect to apply a GDT if you are only using BNG? 

We will skip the science bit about the W*S Specification until later but focus now on the workaround to overcome the problem that this omission in the OGC® W*S Specifications causes in the publishing of W*S using ArcGIS.

Workaround

After you have added your British National Grid data to the DataFrame in ArcMap you should change the DataFrame CRS to GCS_WGS_1984 and apply a transformation (Choose the transformation as per our earlier blog Understanding which Transformation to choose in ArcGIS)

After adding the transformation change the DataFrame back to British National Grid and save the Map Document, then publish to ArcGIS Server as normal.  If you want to add INSPIRE CRS capabilities to the WMS then a further 2 transformations would need to be added - as explained in the Science Bit.

Your problem is resolved!

The Science Bit – For those of you who wish to know.

The OGC® have been informed of the omission of Geodetic Datum Transformations in Web Services (Change Request 09-187 dated 22 December 2009 – Status Pending) but little has been discussed outside of OGC®.

If the native CRS of the data is based on any datum other than GCS_WGS_1984 then there should always be a GDT between that CRS and GCS_WGS_1984; this is required for accurate calculation of <EX_GeographicBoundingBox> attributes if nothing else. 

The formula to calculate the minimum number of GDT required for a WMS (assuming that each GDT is reversible) is:

where x is the different number of Datum required.

So let’s say you have British National Grid data and you need to show the WMS in Web Mercator and INSPIRE, then you have 3 datums and looking at the formula you require 3 GDT such as:

CRS Required in WMS

GDT

EPSG Code

British National Grid

GCS_WGS_1984

GCS_ETRS_1989

OSGB_1936_To_WGS_1984_7

OSGB_1936_To_ETRS_1989_1

ETRS_1989_To_WGS_1984

5339 *

5338 *

1149

 

*  Look at the blog entry OSTN02 supported in ArcGIS desktop to include these transformations in ArcGIS 10.0.

The following is a graph of the formula.

You have already been shown how to add a transformation between British National Grid and GCS_WGS_1984; to add the transformation between British National Grid and GCS_ETRS_1989 you need to have installed the OSTN02 in NTv2 and then change the DataFrame CRS to GCS_ETRS_1989 and apply the “only” transformation available.  To add the final GDT you need to add some GCS_WGS_1984 data while the DataFrame is in GCS_ETRS_1989 then add a transformation selecting GCS_WGS_1984 and the transformation to GCS_ETRS_1989.

Remove the added GCS_WGS_1984 data, change the DataFrame back to British National Grid, save the MXD and publish to ArcGIS Server as normal.

Jim Sibbald is looking at writing an Add-In for ArcGIS 10.0 to provide a simpler interface to the workaround.

Summary

When preparing W*S services with data other than that based on GCS_WGS_1984 you must always ensure that suitable Geodetic Datum Transformation(s) are added to the Map Document before publishing to ensure that you do not get the user problem displayed above.

Jim Sibbald