I want to display a map from MapServer in Openlayers 2.13. I've prepared the Mapfile:
MAP
NAME "WMS Server"
IMAGETYPE PNG
EXTENT 106.637 -6.36199 106.78 -6.231
SIZE 600 300
IMAGECOLOR 255 255 255
SHAPEPATH "../data"
FONTSET "../fonts/fonts.txt"
UNITS dd
WEB
TEMPLATE 'example_template.html'
IMAGEPATH "C:\ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
MINSCALEDENOM 1000
MAXSCALEDENOM 250000
METADATA
"wms_title" "WMS Server Kota Tangerang Selatan"
"wms_onlineresource" "http://localhost:8000/cgi-bin/mapserv.exe?mode=map&map=c:/ms4w/apps/coba1/test3/wms1.map&"
"wms_enable_request" "*"
"wms_srs" "EPSG:4326"
END
END
PROJECTION
"init=epsg:4326"
END
LAYER
NAME "jalan1"
METADATA
"wms_title" "Jalan1"
END
# DATA jalan1
TYPE LINE
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "host=localhost dbname=db_mapserver user=admin_map password=admin port=5433"
DATA "geom from jalan1"
MINSCALE 1000
MAXSCALE 100000
PROJECTION
"init=epsg:4326"
END
CLASS
NAME 'jalan1'
STYLE
COLOR 255 0 0
END
END
END
I tried to access the WMS from QGIS it showed the layer, but when I added it to the map it shows nothing, like this picture:
My assumption is there must be something wrong with the Coordinate System, though when I tried to add the data directly from Postgis it displayed correctly, please help me.
regards
Best Answer
shouldn't it be "port=5432"?
Since the above is not the case, you can comment MINSCALE 1000 MAXSCALE 100000 and recheck in QGis if it appears.
Since now it works in QGis, you need to follow these examples to use google maps or Bings maps (ie. Spherical coordinates) with OpenLayers: