• Blog posts

    Bio

    By David Crowther

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_1.PNG

    Question:

    Why does GeoServer project my Raster Mosaic WMS with EPSG 404000?

    Answer:

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_2.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_3.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_4.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_5.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_6.PNG

    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.

    Resolution:

    To resolve this problem, follow the steps below:

    1 – In GeoServer create an Image Mosaic DATA STORE.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_7.PNG

    ,…pointing to the folder that contains your image tiles e.g. in my case the 50K Raster folder.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_8.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_9.PNG

    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’.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_10.PNG

    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’.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_11.PNG

    5 – Finally, back in GeoServer you can choose to create a New Layer and Publish the Image Mosaic.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_12.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_13.PNG

    The resulting WMS will open perfectly in OpenLayers.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_14.PNG

    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.

    GeoServer___Why_is_my_Image_Mosaic_WMS_using_EPSG_404000_-_15.PNG