[mapserver-users] rendering a raster crossing the antimeridian through a WMS

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed Aug 12 10:28:52 PDT 2015


On 2015-08-12 11:43 AM, fred p wrote:
> Thanks to Jeff for the answer.
>
> I simplified the mapfile to make it easier to read.
>
> Below I give the mapfile with these additional elements. I do not have
> warnings anymore with a GetCapabilities request but the image I get
> whith a GetMap request is still incomplete.
>
> Note that I get an error (/msProcessProjection(): Projection library
> error. proj error "projection not named" for ""/) with a projection
> block in the layer section if I declare the real projection definition
> (/"+proj=longlat +a=6378160 +b=6356775 +no_defs "/). No error with
> /"+init=epsg:4326"/ which is closed to the real projection definition.
> As I have read somewhere that if not present the projection is read in
> the data file, I have removed it (the image I get is the same).
>
>
>
> MAP
>      STATUS       ON
>      NAME         "foo"
>      CONFIG       "MS_ERRORFILE" "stderr"
>      IMAGETYPE    "agg"
>      MAXSIZE      8192
>      EXTENT       -180 -90 180 90
>      PROJECTION
>          "init=epsg:4326"
>      END
>      OUTPUTFORMAT
>          NAME            "agg"
>          DRIVER          "AGG/PNG"
>          MIMETYPE        "image/png8"
>          IMAGEMODE       "PC256"
>          EXTENSION       "png"
>      END
>      WEB
>          METADATA
>              "ows_enable_request"            "*"
>              "ows_sld_enabled"               "true"
>              "wms_feature_info_mime_type"    "text/html"
>              "ows_onlineresource"            "http://127.0.0.1:8080/wms"
>              "wms_title"                     "WMS"
>              "wms_srs"                       "epsg:4326"
>          END
>      END
>      LAYER
>          STATUS        ON
>          TYPE          RASTER
>          NAME          "polar_orbiting_avhrr4"
>          DATA          "/tmp/polar_orbiting_avhrr4.tiff"
>          OFFSITE       0 0 0
>          PROCESSING    "RESAMPLE=NEAREST"
>          METADATA
>              "wms_title" "foo"
>          END
>          #PROJECTION
>          #    "init=epsg:4326"
>          #END
>          #PROJECTION
>          #    "+proj=longlat +a=6378160 +b=6356775 +no_defs"
>          #END
>      END
> END
>
>

Give a good read to the projection page for MapServer 
(http://www.mapserver.org/mapfile/projection.html), take note of the 
Example#1, how to define the PROJ.4 parameters (I believe your error is 
because you've included the "+" by mistake), and then add in your 
projection block to your layer.  And never assume that MapServer can 
magically read your projection and then announce that to all of your WMS 
users: always define each layer's actual projection.  You can also 
experiment with the "PROJECTION AUTO" use, as described on that page, 
but I honestly avoid that and set all accurate projection definitions 
for each layer.

If this was my situation, I'd test this first without WMS, just with the 
shp2img commandline tool, by modifying my output project (see the 
"Important Notes" at 
http://www.mapserver.org/mapfile/projection.html#important-notes) and 
making sure that this layer is reprojected correctly; once that works, 
and I'm satisfied with the map image, I'd start testing the WMS 
reprojection.

-jeff




-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/









More information about the MapServer-users mailing list