[GIS] Projection Library Error Mapserver

mapserver

I have a mapserver installed (Ubuntu Linux 14.04 LTS) with a world.map file which gives me a proper result when I access it as follows:

http://localhost:19090/wms?map=world&layer=world&mode=map&FORMAT=image

However, when I access it using:

http://localhost:19090/wms?map=world&&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=-90,-180,90,180&CRS=epsg:4326&WIDTH=834&HEIGHT=417&LAYERS=world&STYLES=&FORMAT=image/png&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96&TRANSPARENT=TRUE

then I get the following error:

<ServiceExceptionReport version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd"><ServiceException>
msProcessProjection(): Projection library error. proj error "major axis or radius = 0 or not given" for "init=epsg:4326:+epsgaxis=ne"
</ServiceException></ServiceExceptionReport>

Mapserver version: 7.0.0

I have already tried out the solutions that Googling this error generally gives me, namely:

  • Made sure that the epsg file is located in the PROJ_LIB folder
  • Exporting PROJ_LIB folder using an environment variable
  • Checking that the definition of epsg:4326 is in the epsg file

Here us the output of running gdalinfo world.tif:

Driver: GTiff/GeoTIFF
Files: world.tif
Size is 1350, 675
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.266666666666667,-0.266666666666667)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-180.0000000,  90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"N)
Lower Left  (-180.0000000, -90.0000000) (180d 0' 0.00"W, 90d 0' 0.00"S)
Upper Right ( 180.0000000,  90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"N)
Lower Right ( 180.0000000, -90.0000000) (180d 0' 0.00"E, 90d 0' 0.00"S)
Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue

The full map file I am using is as follows:

MAP
  NAME   "world"
  CONFIG "MS_ERRORFILE" "/wmserver/data/logs/mapservice_errors.log"
  CONFIG "PROJ_LIB" "/wmserver/deps/proj.4-master/share/proj"
  CONFIG "ON_MISSING_DATA" "LOG"
  DEBUG 5
  EXTENT -180.000 -90.000 180.000 90.000
  SHAPEPATH "/wmserver/data/service_data/data/wms"
  IMAGECOLOR 255 255 255
  SIZE 1350 675

  WEB
    METADATA
      "wms_title" "Georbis WMS Server"
      "wms_author" "VizExperts"
      "wms_onlineresource" "http://localhost:19090/wms?map=world&"
      "wms_enable_request" "*"
      "wms_srs" "EPSG:4326"
      "wms_feature_info_mime_type" "text/html"
      "wms_format" "image/jpg"
    END
  END

  PROJECTION
    "init=epsg:4326"
    "proj=latlong"
    "ellps=WGS84"
    "datum=WGS84"
  END

  LAYER
    NAME world
    TYPE RASTER
    DATA "world.tif"
    METADATA
      "wms_title" "BlueWorld Map"
      "wms_srs" "EPSG:4326"
      "wms_server_version" "1.1.1"
    END
    PROJECTION
      "init=epsg:4326"
      "proj=latlong"
      "ellps=WGS84"
      "datum=WGS84"
    END
  END
END

Mapserver error log:

[Mon Sep 14 04:34:57 2015].834042 msWMSLoadGetMapParams(): enabling non-square pixels.
[Mon Sep 14 04:34:57 2015].834072 msProcessProjection(): Projection library error. proj error "major axis or radius = 0 or not given" for "init=epsg:4326:+epsgaxis=ne"
[Mon Sep 14 04:34:57 2015].834103 mapserv request processing time (msLoadMap not incl.): 0.000s
[Mon Sep 14 04:34:57 2015].834118 msFreeMap(): freeing map at 0x1fa2b60.

What am I doing wrong?

Best Answer

I not an expert on the internal workings of MapServer, but basically as I understand it you use a single .map configuration file as the basis of multiple service types; so you can in theory have one input data source, one .map file and from this provide a WMS, WFS, SOS, WCS (in multiple different versions) and also use the CGI variables to provide some output.

Now these alternate output offerings look at different parts of the map file to find the information they need for their specific requirements, and/or look at multiple locations to find information they require and then use some precedence rules to work out any conflicts. This precedence is well documented in the MapServer documentation (but can be confusing) for example, see Rules for Handling SRS in MapServer WFS.

So to attempt to address the first part of your question as to why the CGI map output displays but the WMS doesn't, I assume it's because CGI based service looks at a different location (or has different precedence rules) for working out the correct projection than the WMS service.

There are many places in .map file that projection information can be referenced, and one of those is the PROJECTION block, which can be found as part of the MAP information (where it should be used to define the default projection of the WMS), &/or part of a LAYER information (where it should be used to define the projection that the data is natively in).

One way of defining a projection is to use the init parameter (as below), which is a call to a proj4 file called (epsg) on your server, and within that file to the <4326> definition.

PROJECTION
    "init=epsg:4326"
END

Points to the following line in the epsg file:

<4326> +proj=longlat +datum=WGS84 +no_defs  <>

Alternatively you can define a projection using the proj4 parameters, so if you wish you could define epsg:4326 as below:

PROJECTION
    "proj=longlat"
    "datum=WGS84"
    "no_defs"
END

In your .map configuration file you have effectively, made a call to a file with a full definition of a projection, and then added additional (and conflicting) information to define your projection. It appears that MapServer has attempted to add these two definitions, and then failed, because your data is not in the projection you specified.