By David Crowther
Why does GeoServer project my Raster Mosaic WMS with EPSG 404000?
Even if your source image tiles are projected to British National Grid (27700), when I create an Image Mosaic WMS the Coordinates System (CRS) settings believe they are projected to 404000.
The reason for this is that in the previous step when you create the Data Store: Image Mosaic as part of this step a Shapefile is created to store the coordinates for each of the source image tiles.
If you open the Mosaic Shapefile (in this case 50K.shp) in QGIS you will see that the Shapefile does not have the same projection as the source image tiles.
This means that if we progress to the next step in GeoServer and try to Publish the new layer, the source CRS will be incorrect and will be 404000.
For applications such as QGIS this is not an issue as QGIS will ask you to choose a projection for the file on opening and the user can manually choose BNG 27700. Once opened in QGIS we can see that the Mosaic Shapefile has a Location attribute for each of the image tiles which are used to georeference and tile the images into one WMS.
For other applications e.g. a webGIS (MapThat) the Image Mosaic WMS will fail to load as the projection has not been correctly defined, so the WMS will not render in the correct location.
To resolve this problem, follow the steps below:
1 – In GeoServer create an Image Mosaic DATA STORE.
,…pointing to the folder that contains your image tiles e.g. in my case the 50K Raster folder.
2 – Before creating the NEW LAYER from this new Store, open the 50K shapefile in QGIS and export/re-project the files using the BNG 27700 projection.
3 – Replace the original 50k shapefile (404000) with the new BNG 27700 shapefile in the same folder as the image tiles.
4 – You will then need to edit the Layer.Properties file which stores the information about the Mosaic, such as the projection, caching options and field name that stores the image titles. In this case the file is called 50K and has the type ‘Properties File’.
Having opened the file in notepad, change the EPSG to be 27700. In this case there is no need to change any other values as the field name for the tiles is still called ‘location’.
5 – Finally, back in GeoServer you can choose to create a New Layer and Publish the Image Mosaic.
You will see that in the CRS section, GeoServer now recognises that the Image Mosaic has a source/native projection of 27700…. and now no mention of 40400! Which means that we don’t need to reproject or force a declared projection, we can instead choose ‘Keep Native’ projection.
The resulting WMS will open perfectly in OpenLayers.
And if you have the DynamicMaps webGIS – MapThat – you will now be able to render your Image Mosaic WMS tiles as a basemap or layer for your users.