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.
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
British National Grid
* 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.
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.
We recently published an article on the basics of Coordinate and Projections for UK users in ArcGIS. In response to this article we received a really interesting follow-up question:
“Please can you provide some more information on why the Petroleum transformation should be used? Are there any cases where another transformation in the list should be used?”
When transforming data between WGS-84 and BNG it can be confusing which options to choose. At ArcGIS 10 you are presented with 7 different options.
So, what are the differences and which one should you choose?
Essentially each option has a different accuracy depending on the output accuracy you require on your data but also the geographic area in which it resides. This is best summarised using the following table (reproduced by kind permission from Jim Sibbald).
* with configuration
As you can see the OSGB_1936_To_WGS_1984_Petroleum has the best accuracy around the UK out of the box within ArcGIS.
However, what if you are collecting data from a GPS device in WGS-84 and when transforming you require greater accuracy than ±2 meters? The most accurate transformation between British National Grid and WGS 1984 would be using the OSTN02 transformation.
At present, out of the box, ArcGIS doesn’t support this type of transformation. If you require this level of accuracy there are a number of options depending on the version of ArcGIS that you’re using. However, after working in collaboration with DGC and Ordnance Survey, Esri UK have released OSTN02 support within ArcGIS desktop.
Configuring OSTN02 Transformation in ArcGIS 10.1
Users of ArcGIS 10.1 will be able to take advantage of OSGB_1936_To_WGS_1984_7 supported as shown in Figure 1. This requires the user to download the .grb file from Ordnance Survey and to place it in the appropriate folder.
Figure 1 - OSTN02 in NTv2 in ArcGIS 10.1
To utilise this transformation method simply download and paste the OSTN02_NTv2.gsb into a folder called ‘C:\Program Files\ArcGIS\Desktop10.1\pedata\ntv2\uk’. You will need to create the folder called ‘uk’ which must be in lower case. Next time you restart ArcGIS 10.1 you will be able to use this transformation from the Geographic Coordinate Systems Transformations dialog box.
Details of the copyright and liability of the files are here.
Configuring OSTN02 Transformation in ArcGIS 10
To add this support in ArcGIS 10 you will need to download and install an add-in. More information about this add-in can be found in the following blog article: OSTN02 supported in ArcGIS desktop.
In both cases, if you are using ArcGIS Server then remember that you need to install it in both areas, especially if you are publishing maps from an MXD with it applied.
However, you also need to be aware that the accuracy of the Petroleum and NTv2 (OSTN02) transformations also fluctuates around different parts of the UK.
As such, the OSTN02 transformation is the most accurate but not included by default. With most UK data requiring an accuracy of approximately ± 2 meters the Petroleum transformation is fine for common applications and uses.
This blog post gives a basic introduction to coordinate systems and projections, with a focus on UK data. To seasoned geographers, I apologise for all the things I've simplified or simply left out! My intention is to provide GIS novices who are a bit confused by the topic with just enough about various different coordinate systems to get started working with them in ArcGIS. Anyone looking for an excellent comprehensive introduction should refer to Ordnance Survey's guide.
A coordinate system lets us define where a location is in space. In GIS, there are many types of coordinate systems, of which the two most used are geographic (3D) and projected (2D). The difference is shown below:
A geographic coordinate system (GCS) uses a grid on the surface of a 3D globe (the technical term for this grid is graticule; the North/South lines are lines of longitude and the East/West lines are lines of latitude). Graticule lines are not parallel to each other because they are defined using angles (e.g. degrees) from the centre of the globe, not linear units (e.g. metres) on a flat surface.
A projected coordinate system (PCS) is a flattened version of a 3D coordinate system. Grid lines are parallel, and coordinates are given in "flat" units like metres or feet. Although the Earth isn't flat, we often use flat surfaces to represent it (paper surfaces, computer screens, etc), so we frequently need to convert 3D coordinates to 2D coordinates. However, there's a problem: imagine peeling the skin off an orange and trying to make it sit flat on a table. It's not possible to do this without ripping or stretching the peel! It's the same with a 3D coordinate system. Whenever we flatten, or "project", a 3D coordinate grid to a 2D coordinate grid, we have to distort the grid's proportions somehow. Distances, shapes, areas, and angles, or some combination of all four, are deformed.
If you work with UK data, there are two geographic and two projected coordinate systems that you should know about. They are shown in the diagram below, along with the numeric WKID (Well-Known ID) of that GCS/PCS, as well as their relationships with one another and example coordinates in each system showing the location of Esri UK's head office in Aylesbury.
World Geodetic System (WGS-84) is familiar to many non-geographers because it is used by GPS devices to describe locations all over the Earth. A different GCS, called OSGB-36, which is more accurate for describing locations in Britain but not as good for other countries, is used specifically for British data. Web Mercator is a PCS based on WGS-84 used for global maps, and British National Grid is a PCS based on OSGB-36 used for British maps.
For each GCS, there are many different ways of converting, or "projecting", 3D coordinates to 2D coordinates. Web Mercator and British National Grid are the most important projections for their respective geographic coordinate systems. There are alternative projections, each with its own pros and cons (this link has more information, as well as an entertaining video clip).
Converting between coordinate systems that are based on the same GCS is relatively straightforward, but when converting, for example, GPS (WGS-84) coordinates to BNG eastings and northings, a mathematical transformation is required. The "Petroleum" transformation is an accurate transformation from WGS-84 to OSGB-36 (and vice-versa) included with ArcGIS.
To convert data between WGS-84 and BNG in ArcGIS Desktop, you should use the Project tool. Make sure you select the "Petroleum" transformation otherwise your results will not be accurate.
Select the optional Petroleum transformation for the best results
For GB data, you only really need to know about WGS-84 and BNG, and that you should use the Petroleum transformation to get an accurate conversion between them. You will also need to use "Petroleum" to convert between BNG/OSGB-36 and Web Mercator (or WGS 1984 Web Mercator Auxiliary Sphere, to give it the name used by Esri). Web Mercator has become the standard projection for international consumer web maps, such as Google Maps, Bing Maps, and OpenStreetMap. All ArcGIS Online basemaps are also in this projection.