Friday, 12 February 2016

coordinate system - Why is MapServer adding horizontal artifacts when projecting EPSG:4326 data to EPSG:3857?



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:


enter image description here


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.



Answer



Check whether your shapefiles are valid and contain no unclosed polygons. Apart from that it is better for your performance to reproject your shapefile first.


This can be done with eg ogr2ogr: ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3857 outfile.shp infile.shp


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...