Nicholas Efremov-Kendall wrote: > I'm trying to get a simple OL application to display a mapserver > mapfile, but all I get is the grey background for the image, and a the > embedded scale bar displaying much smaller linear measurements than > the static mapserver file (0.2 vs 16 km). I have specified for the OL > map projection to be UTM 32N (Epsg: 22332) and meters for Units. I > don't understand why the display coordinated for the mouse position > are still LatLon and why the map data won't display. It's reading the > mapfile, but I don't know why I won't display the raster or verctor data. > any suggestions?
You need Mapserver to render layers defined in a mapfile. OpenLayers can then request images from Mapserver, but it won't work directly with mapfiles. See http://docs.openlayers.org/library/layers.html for layer types supported by OpenLayers. > > JS CODE > map = new OpenLayers.Map('map', { projection: new > OpenLayers.Projection("EPSG:22332"), > displayProjection: new > OpenLayers.Projection("EPSG:22332"), units: "meters"}); > layer = new OpenLayers.Layer.MapServer( "Jerba", > "http://localhost/cgi-bin/mapserv", {map: > '/home/mapdata/jerba.map', layers: "satt"} ); > map.addLayer(layer); > map.zoomToExtent( new OpenLayers.Bounds (629664.75, > 3694383.75, 718556.25, 3770763.75)); > map.addControl( new > OpenLayers.Control.LayerSwitcher() ); > map.addControl( new OpenLayers.Control.MousePosition() ); > map.addControl( new > OpenLayers.Control.OverviewMap() ); > map.addControl( new OpenLayers.Control.ScaleLine() ); You also have to specify a maxExtent for either the map or your layer. Regards, Andreas. -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
