0

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: enter image description here

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

2
  • yeah it now showed up in the QGIS, but I'm still no luck in the OpenLayers, how can I overlayed the data using an OSM or Gmaps as baselayer in openlayers?
    – iqnaul
    Commented Jan 22, 2014 at 15:07
  • please I edited my answer, check it and see if it worked for you.
    – Gery
    Commented Jan 22, 2014 at 15:34

1 Answer 1

0

shouldn't it be "port=5432"?

CONNECTION "host=localhost dbname=db_mapserver user=admin_map password=admin 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:

1
  • I've changed the default port of my Postgresql to "5433"
    – iqnaul
    Commented Jan 22, 2014 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.