Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have some shapefiles in "World Cylindrical Equal Area (Lambert) projection". The .prj reads:

PROJCS["World_Cylindrical_Equal_Area",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_
1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PR
OJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",
0.0],PARAMETER["Central_Meridian",-160.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1
.0]]

In consequence, I wrote the following mapfile:

MAP
    NAME "mapTest"
    OUTPUTFORMAT
      NAME "png"
      DRIVER AGG/PNG
      MIMETYPE "image/png"
      IMAGEMODE RGBA
      EXTENSION "png"
      FORMATOPTION "GAMMA=0.75"
      TRANSPARENT ON
    END
    SIZE 800 600
    EXTENT -20037507.067162 -6363885.331926 20037507.067162 6324287.725856
    UNITS meters
    SHAPEPATH "/data/"
    IMAGECOLOR 255 255 255
    FONTSET "/usr/share/fonts/truetype/ubuntu-font-family/bruno_fontsets.list"

    WEB
      IMAGEPATH "/data/tmp/"
      IMAGEURL "/tmp/"
      METADATA
        wms_title "WMS Demo Server"
            wms_onlineresource  "http://localhost/cgi-bin/mapserv?map=/var/www/ex/mapTest.map&"
        wms_enable_request "*"
      END # metadata
    END # web

    PROJECTION
      "proj=cea"
       "lon_0=-160"
       "lat_ts=0"
       "x_0=0"
       "y_0=0"
       "ellps=WGS84"
       "datum=WGS84"
       "units=m"
       "no_defs"
    END

    #######################"
    LAYER
      NAME "countries"
      STATUS ON
      TYPE POLYGON

      PROJECTION
        "proj=cea"
        "lon_0=-160"
        "lat_ts=0"
        "x_0=0"
        "y_0=0"
        "ellps=WGS84"
        "datum=WGS84"
        "units=m"
        "no_defs"
      END

      DATA "/data/data_repo/WRI/Base_Data/Countries/Countries"
      LABELITEM "COUNTRY"
      PROCESSING "LABEL_NO_CLIP=ON" #avoid repeating labels
      CLASS
        NAME "countries"
        STYLE 
          OUTLINECOLOR 200 200 200
          WIDTH 0.5
          ANTIALIAS true
        END # style

        LABEL
          COLOR 50 50 49
          MINFEATURESIZE 20
          MINDISTANCE 10000
          REPEATDISTANCE 0
          BUFFER 5
          SIZE 12
          FONT "Ubuntu-C"
          TYPE truetype
          POSITION auto
          PARTIALS FALSE
        END # label

      END # class
      METADATA
        wms_name "countries"
      END # metadata
    END # LAYER
    ###########################

END # MAP

and the following openlayers code:

 <html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="../lib/openlayers/OpenLayers.js"></script>
    <script type="text/javascript">

      var map;

      function init() {
      map = new OpenLayers.Map({div:'myMap', allOverlays:true});

      var countries = new OpenLayers.Layer.MapServer("Countries", "/cgi-bin/mapserv?MAP=/var/www/ex/mapTest.map", {layers:'countries'});

      map.addLayers([countries]);
      var mapSwitcher = new OpenLayers.Control.LayerSwitcher();
      map.zoomToMaxExtent();
      }

    </script>
  </head>

  <body onload="init()">
    <div id="myMap" ></div>
  </body>

</html>

Unfortunately, the displayed image is completely messed-up:

mapserver messes-up a CEA-projected shapefile

Can someone find what is incorrect in my codes?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.