We're running MapServer with a map that has just one layer, political boundaries from a SHP file. This layer is using a basic EPSG:4326 projection, and the map itself is using EPSG:3857. The resulting images generated by MapServer CGI queries have horizontal lines at certain latitudes:
Beyond this problem, the map is okay and lines up perfectly with the Open Street Map in OpenLayers. The MAPFILE we're using:
MAP WEB METADATA "wms_title" "Map Server" "wms_enable_request" "*" "wms_srs" "EPSG:3857" END END PROJECTION "init=epsg:3857" END IMAGETYPE PNG EXTENT -20037508.34 -20037508.34 20037508.34 20037508.34 SIZE 400 300 SHAPEPATH "../data" IMAGECOLOR 71 245 242 LAYER # States polygon layer begins here NAME Borders DATA ne_10m_admin_1_states_provinces_shp STATUS OFF TYPE POLYGON PROJECTION "init=epsg:4326" END CLASS NAME "Borders" STYLE COLOR 43 156 51 OUTLINECOLOR 32 32 32 END END END # States polygon layer ends here END
I've verified that the proj.4 EPSG file has the proper definition of EPSG:3857, and don't understand what's happening. Any insight would be greatly appreciated.
Best Answer
Your question implies that the problem doesn't occur when the data isn't projected. Is this the case?
It looks like the issue is with features that cross the -180 / +180 meridian. The problem arises when the GIS assumes that the west boundary of the polygon has a lower X ordinate than the east boundary, but in these cases this is reversed.
The problem isn't specific to MapServer and I expect you would see the same issue in any GIS software.
One way to address this sticky problem is to split these polygons over the meridian, so that the east side of the feature displays on the west of the map and the west side of the polygon is on the east side of the map.