[GIS] MapServer – map rendered at the wrong angle

coordinate systemmapserverrendering

I've just started using MapServer to check the topology in my database, and whenever I render a map I have to flip the image vertically and then rotate it quite a bit to get it facing North. I've set the projections to WGS84 but it doesn't seem to have any effect. Any ideas what I'm doing wrong?

The way I'm calling MapServer

http://localhost/cgi-bin/mapserv?map=test.map&layers=all&map_imagetype=JPEG&mode=map&mapext=52.8055+-2.0924+52.8175+-2.0785&map_size=1000+1000

The map file can be found at http://pastie.org/pastes/1647658/text

Here's an image showing how the map gets rendered and also what angle it should be at..
MapServer render

Also, when I try to overlay the image onto Google Maps I can't get any of the roads to line up with the Google ones. I know that my data is correct as I've checked the lon/lat values in the database against Google and they match up perfectly.. it's only when I output via MapServer that it doesn't match up.

Any thoughts would be appreciated!

Best Answer

Assuming that your geometries in PostGIS actually represent the true lat and lon of your locations. e.g. x value = lon and y value = lat:

I see a few weird things:

  1. You have defined an output projection that is geographic, but with units of meters. Is this what you really want to do? I think that with Google, you either use a geographic spatial reference system with units of decimal degrees, or 'World Mercator' e.g. epsg:909913 or epsg:4785

  2. With MapServer, you need to define your map extent in the units of the output projection. You have specified meters as your units, but it looks like you are trying to set an extent in decimal degrees.

  3. In MapServer an extent is expressed as minx miny maxx maxy. When you say:
    mapext=52.8055+-2.0924+52.8175+-2.0785 Are you trying specifying an area in Ethiopia or Staford? I believe that you have your x and y coordinates reversed.

Related Question