[OpenLayers-Users] Display Map from MapServer with OpenLayers

Pfirter Lukas lp at rpag.ch
Fri May 11 04:24:20 EDT 2007


Hi Barend,

Your solutions sounds interesting. But I think this is for legends (as explanations of different objects) only. Or else a Javascript would have to reload that scalebar-image with every OL-Zoom-Change and tell it, how deep OL is zoomed in/out. Well I didn't get this to work anyways but don't want to invest further into it as it is only a test project to see what you can do with OL.

But I would like to use this scalebar with "OpenLayers.Layer.WMS.Untiled". This layer works, but the scalebar disappears when I use this instead of "OpenLayers.Layer.WMS". The "Untiled"-performance is almost as good as before - just doesn't show the bar. Do I have to change anything ion the mapfile (currently: "STATUS EMBED")?

Thanks,
Lucas



-----Ursprüngliche Nachricht-----
Von: Barend Köbben [mailto:kobben at itc.nl] 
Gesendet: Donnerstag, 10. Mai 2007 13:28
An: Pfirter Lukas
Betreff: Re: [OpenLayers-Users] Display Map from MapServer with OpenLayers

I guess that in your map file you have "SCALEBAR" set to STATUS EMBED". That way you'll get the scalebar repeated in every tile OpenLayers requests.
AFAIK the onlys solution is having this tiling beahviour stopped, by asking for a "OpenLayers.Layer.WMS.Untiled" in stead of " OpenLayers.Layer.WMS". It will affect your performance though...

For the Legend, you'd get the same problem, but you can overcome that one by having the "STATUS ON" and then request it seperately in you web page by issueing an OGC GetLegendGraphic request (for an example see http://geoserver.itc.nl/mapserver/OpenLayersQuery.html). Unfortunately there is no such thing for the scalebar...

__
Barend Köbben
International Institute for Geo-information Sciences and Earth Observation (ITC) PO Box 6, 7500AA Enschede (The Netherlands)
ph: +31 (0)53 4874253; fax: +31 (0)53 4874335



On 10-05-2007 09:07, "Pfirter Lukas" <lp at rpag.ch> wrote:

> I just got this work, thank you!
> I needed to implement the following code:
> 
> var wmslayer = new OpenLayers.Layer.WMS( "WMS Layer",
> "http://domain.com/cgi-bin/mapserv?map=/path/to/file.map", {layers:
> 'Layername'} );
> map.addLayers([wmslayer]);
> 
> Now, the only problem I have left is, that the distance measuring bar, sended
> by the mapserver, is displayed a few times inside the OL window. Is it
> possible to still use this dynamically generated bar with OL but have it
> displayed only once (for example in a corner)? Or do I have to disable this
> bar in the ".map"-File and can not use it in OL?
> 
> Lucas
> 
> 
>  
> 
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von Barend Köbben
> Gesendet: Mittwoch, 9. Mai 2007 16:57
> An: Users at openlayers.org
> Betreff: Re: [OpenLayers-Users] Display Map from MapServer with OpenLayers
> 
>> Try this instead:
>> 
>> layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>> "http://domain/cgi-bin/mapserv?map=/path/to/project.map
>> <http://domain/cgi-bin/mapserv?map=/path/to/project.map> ", {layers:
>> 'basic'} );
> 
> ...or, if you need SLD based stylings (as I did):
>  
> "http://domain/cgi-bin/mapserv?map=/path/to/project.map
> <http://domain/cgi-bin/mapserv?map=/path/to/project.map> ",
> {layers: "landcover",
>      SLD: "url-to-your-SLD <http://geoserver.itc.nl/mapserver/sld/galicia.xml>
> "}
>      );
>  
> ...and if you want the layer to be an overlay iso. a base layer:
>  
> "http://domain/cgi-bin/mapserv?map=/path/to/project.map
> <http://domain/cgi-bin/mapserv?map=/path/to/project.map> ",
> {layers: "landcover",
>      SLD: "url-to-your-SLD <http://geoserver.itc.nl/mapserver/sld/galicia.xml>
> ",
>      format: "image/png",
>      transparent: "true"}
>      );
> --
> Barend Köbben
> International Institute for Geo-information Sciences and  Earth Observation
> (ITC) PO Box 6, 7500AA Enschede (The Netherlands)
> ph: +31-(0)534874253; mobile: +31-(0)622344955
> 
>  
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list