[OpenLayers-Users] My map is displayed only at zoom level 0
Alexandre Dube
adube at mapgears.com
Fri Feb 20 08:39:09 EST 2009
amila.maha wrote:
> Hi,
>
> I am trying to display a map from MapServer in OpenLayer. But it is
> displayed only when the zoom level is zero. When the zoom level is some
> other level, only a white image is shown.
>
> Can somebody help me with this??
>
> This is my javascript code segment for creating the map.
>
> var map_sv = new OpenLayers.Layer.MapServer( "Clouds",
>
> "http://localhost:7788/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/openlayer/map/wms-test.map",
> {layers: "clouds", isBaseLayer: "true"});
>
Your layer object is wrong, it should looks like this :
OpenLayers.Layer.MapServer(name, url, params, options).
"layers" is a parameter for mapserver cgi url and "isBaseLayer" is an
OpenLayers option :
var map_sv = new OpenLayers.Layer.MapServer(
"Clouds",
"http://localhost:7788/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/openlayer/map/wms-test.map",
{layers: "clouds"},
{isBaseLayer: "true"});
That might not be enough to resolve your problem but it's another fix at
least.
See the examples for more easy learning :
http://openlayers.org/dev/examples/
http://openlayers.org/dev/examples/mapserver.html
Regards,
Alexandre
>
> This is my map file.
>
> NAME "WMS-test"
> STATUS ON
> SIZE 512 256
> SYMBOLSET ../etc/symbols.sym
> EXTENT -180 -90 180 90
> UNITS METERS
> IMAGECOLOR 255 255 255
> IMAGETYPE png
> FONTSET ../etc/fonts.txt
> CONFIG "PROJ_LIB" "C:/ms4w/proj/nad/"
>
>
> WEB
> IMAGEPATH "C:/ms4w/tmp/"
> IMAGEURL "/ms_tmp/"
> METADATA
> "wms_title" "WMS Demo Server" ##required
> "wms_onlineresource" "http://localhost:7788/cgi-bin/mapserv.exe?"
> ##required
> "wms_srs" "EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326"
> END
> END
>
> PROJECTION
> "init=epsg:42304" ##required
> END
>
> #
> # Start of layer definitions
> #
>
> LAYER
> NAME clouds
> METADATA
> "wms_title" "Clouds" ##required
> END
> TYPE RASTER
> STATUS ON
> PROJECTION
> "init=epsg:42304" ##recommended
> END
> DATA "../data/test/day_clouds.tif"
> END
>
> END # Map File
>
>
>
>
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list