[OpenLayers-Users] Why is mapserver layer not showing up in openlayers?

Gery . gamejihou at hotmail.com
Tue Apr 9 09:28:47 PDT 2013


You need to set WEB in your map file and to use EPSG 900913 (or 3857) in projection if you want that shp working with google. You're using "init=epsg:32748" for the shp, so you need to add this EPSG to the WEB section above mentioned in your map file also, ie, "EPSG:4326 EPSG:900913 EPSG:32748". If you google that, you'll find several examples (at least) about EPSG stuff and projection tricks for mapserver and openlayers.

Sent from my iBath

On Apr 9, 2013, at 14:14, "INDRA BAYU" <cucuberlian at gmail.com> wrote:

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 script

===================== "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
=============================================================


========================"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?
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list