[OpenLayers-Users] A very simple application doesn't work

Christopher Schmidt crschmidt at metacarta.com
Wed Apr 4 11:16:44 EDT 2007


On Wed, Apr 04, 2007 at 05:12:44PM +0200, Dmitri Mizerkin wrote:
> Hi Steve,
> 
> I assume it is working with the Layer/Mapserver class, only that the site is
> still empty. I looked at the address of the map in the the properties window
> - the part of it that as I suspect prevents it from working is the
> mapextent, which is set to -180 -90 180 270 (initial maximum extent).
> Setting up the extent via OpenLayers didn't bring any success neither over
> 
> var wms2 = new OpenLayers.Layer.MapServer("BGL Abschnitte", "
> http://localhost:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/test/htdocs/test.map",
> {mode: 'map', layers: 'Flaeche', mapext: '2574985.815002 5646323.449916
> 2587295.900005 5655021.169988'});

Don't do this.


Read this:

http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#Projections

then do this:

new OpenLayers.Map("map", {maxExtent: new
OpenLayers.Bounds(2574985.815002, 5646323.449916, 2587295.900005,
5655021.169988),
maxResolution: 'auto', units: 'meters', projection: "EPSG:41001"});

combined with something like:

> var bounds = new OpenLayers.Bounds(2574985.815002, 5646323.449916,
> 2587295.900005, 5655021.169988);
> map.zoomToExtent(bounds);

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list