Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm currently setting up a Mapserver/OpenLayers application. My mapscript works fine when i run on mapserver, but my mapserver layer not showing up in openlayers.

this is my mapscript "tangsel.map"


MAP
  NAME "TANGSEL"
  STATUS ON
  EXTENT 106.636718 -6.363274 106.779904 -6.228827
  SIZE 885 600
  SHAPEPATH "../shp"
  IMAGETYPE PNG
  IMAGECOLOR 252 253 255
  UNITS DD

  PROJECTION
    "init=epsg:4326"
  END

  LAYER
      PROJECTION
        "init=epsg:32748"
      END
      NAME "tangsel"
      DATA "tangsel" 
      TYPE POLYGON
      STATUS ON
      CLASS
          NAME "tangsel"
          COLOR 0 0 120
          OUTLINECOLOR 0 0 0
      END
  END

END

file html "index.html"


            var map;

            function init() {
                map = new OpenLayers.Map({
                    div: "map",
                    projection: "EPSG:4326",
                    displayProjection: "EPSG:4326",
                    controls: [
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoomBar(),
                        new OpenLayers.Control.ScaleLine(),
                        new OpenLayers.Control.MousePosition(),
                        new OpenLayers.Control.KeyboardDefaults()
                    ]

                });

                // create Google Mercator layer
                var gphy = new OpenLayers.Layer.Google(
                    "Google Physical",
                    {type: google.maps.MapTypeId.TERRAIN}
                );

                // create Mapserver layer
                var msv = new OpenLayers.Layer.MapServer( "SHP", 
                    "http://localhost/cgi-bin/mapserv.exe", 
                    {map: 'e:/ms4w/ppgt/map/tangsel.map'}, 
                    {layers: 'tangsel', srs: 'EPSG:4326', isBaseLayer: false, visibility: true}, 
                    {gutter: 15} 
                );

                // Key Map
                var keymap = new OpenLayers.Control.OverviewMap({
                    maximized: true,
                    maximizeTitle: 'Show the overview map',
                    minimizeTitle: 'Hide the overview map'
                });
                map.addControl(keymap);

                map.addLayers([gphy, msv]);
                map.setCenter(new OpenLayers.LonLat(106.716677, -6.295165).transform('EPSG:4326', 'EPSG:3857'), 11);
                map.addControl(new OpenLayers.Control.LayerSwitcher());             
            }

does someone know what the problem is?

share|improve this question
    
Usually Mapserver explains in plain english, what's wrong and why it doesn't give result. What to do: a) use some kind of developer tool (like FireBug) to examine, whether there are errors in Javascript b) examine WMS request, that is made by OpenLayers (Network tab in FireBug). If necessary, copy URL from FireBug and open it directly in browser. In case of error, you get error report (in XML by default, see Exceptions parameter in WMS query). –  user1702401 Apr 9 '13 at 12:12
    
Can you consume the WMS service in any other client, say QGIS? –  Devdatta Tengshe Apr 12 '13 at 16:01
add comment

1 Answer

Your layers projection in the mapscript is different from the msv layers projection in OpenLayers, could it be the problem? I would use epsg:4326 everywhere

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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