Problem I have: map tiles from my layer are being repeated.
Shapefile is projection 3059. I have specified 3059 is in the mapfile and also when creating map object.
I know OpenLayers.Layer.WMS is recommended, but when I use it I only see empty map. When I use OpenLayers.Layer.MapServer, map is displayed (and tiles are repeated), so I'm using that for now.
My layer (EPSG:3059) looks like this
Versions:
Openlayers 2.13.1
MapServer 6.0.3
WMS Server mapfile:
MAP
NAME country_map
STATUS ON
SIZE 800 500
EXTENT 313187.4 146161.56 766469.92 470367.64
UNITS METERS
SHAPEPATH "shapefiles"
IMAGECOLOR 155 155 155
WEB
TEMPLATE "template.html"
IMAGEPATH "C:/MS4W/ms4w/apache/htdocs/gis/output/"
IMAGEURL "/gis/output/"
METADATA
"wms_title" "MapServer + Openlayers"
"wms_onlineresource" "http://localhost:1025/cgi-bin/mapserv.exe?map=C:\MS4W\ms4w\Apache\htdocs\gis\mapfile2.map"
"wms_enable_request" "*"
"wms_srs" "EPSG:3059"
END
END
PROJECTION
"init=epsg:3059"
END
# example layer
LAYER
METADATA
"wms_title" "lat_rob_region"
END
NAME "lat_rob_region"
DATA lat_rob_region
STATUS ON
TYPE POLYGON
CLASS
NAME "lat_rob_region"
STYLE
COLOR 0 255 0
END
END
END
END
Javascript:
var lon = 25;
var lat = 57;
var zoom = 5;
var map, layer1;
function init()
{
map = new OpenLayers.Map( 'map',{displayProjection: new OpenLayers.Projection("EPSG:3059")} );
layer1 = new OpenLayers.Layer.MapServer( "Country map",
"http://localhost:1025/cgi-bin/mapserv.exe?map=C:/MS4W/ms4w/Apache/htdocs/gis/mapfile2.map", {layers: 'lat_rob_region'},
{gutter: 15},{srs: 'EPSG:3059'});
map.addLayer(layer1);
map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}