[OpenLayers-Users] Display Map from MapServer with OpenLayers

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Fri May 11 04:38:12 EDT 2007


Your Mapserver image is probably larger than what you see, so the scalebar
is out of sight.

Try using ratio:1, like:

baselayer0 = new OpenLayers.Layer.WMS.Untiled( "Standaard",
               
"http://test.intranet.rijkswaterstaat.nl/services/geoservices/startkaart?",
{layers: 'startkaart', 'format':'image/gif', 'transparent':'TRUE'},
{'numZoomLevels': 12, 'ratio':1, isBaseLayer: true} ); 

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: Pfirter Lukas <lp at rpag.ch>
Naar: Users at openlayers.org <Users at openlayers.org>
Onderwerp: Re: [OpenLayers-Users] Display Map from MapServer with OpenLayers
Datum: 11/05/07 06:24

> 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
&quot;OpenLayers.Layer.WMS.Untiled&quot;. This layer works, but the scalebar
disappears when I use this instead of &quot;OpenLayers.Layer.WMS&quot;. The
&quot;Untiled&quot;-performance is almost as good as before - just doesn't
show the bar. Do I have to change anything ion the mapfile (currently:
&quot;STATUS EMBED&quot;)?
> 
> 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 &quot;SCALEBAR&quot; set to STATUS
EMBED&quot;. 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 &quot;OpenLayers.Layer.WMS.Untiled&quot; in stead of &quot;
OpenLayers.Layer.WMS&quot;. It will affect your performance though...
> 
> For the Legend, you'd get the same problem, but you can overcome that one
by having the &quot;STATUS ON&quot; 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, &quot;Pfirter Lukas&quot; &lt;lp at rpag.ch&gt; wrote:
> 
> &gt; I just got this work, thank you!
> &gt; I needed to implement the following code:
> &gt; 
> &gt; var wmslayer = new OpenLayers.Layer.WMS( &quot;WMS Layer&quot;,
> &gt; &quot;http://domain.com/cgi-bin/mapserv?map=/path/to/file.map&quot;,
{layers:
> &gt; 'Layername'} );
> &gt; map.addLayers([wmslayer]);
> &gt; 
> &gt; Now, the only problem I have left is, that the distance measuring
bar, sended
> &gt; by the mapserver, is displayed a few times inside the OL window. Is
it
> &gt; possible to still use this dynamically generated bar with OL but have
it
> &gt; displayed only once (for example in a corner)? Or do I have to
disable this
> &gt; bar in the &quot;.map&quot;-File and can not use it in OL?
> &gt; 
> &gt; Lucas
> &gt; 
> &gt; 
> &gt;  
> &gt; 
> &gt; -----Ursprüngliche Nachricht-----
> &gt; Von: users-bounces at openlayers.org
[mailto:users-bounces at openlayers.org] Im
> &gt; Auftrag von Barend Köbben
> &gt; Gesendet: Mittwoch, 9. Mai 2007 16:57
> &gt; An: Users at openlayers.org
> &gt; Betreff: Re: [OpenLayers-Users] Display Map from MapServer with
OpenLayers
> &gt; 
> &gt;&gt; Try this instead:
> &gt;&gt; 
> &gt;&gt; layer = new OpenLayers.Layer.WMS( &quot;OpenLayers WMS&quot;,
> &gt;&gt; &quot;http://domain/cgi-bin/mapserv?map=/path/to/project.map
> &gt;&gt; &lt;http://domain/cgi-bin/mapserv?map=/path/to/project.map&gt;
&quot;, {layers:
> &gt;&gt; 'basic'} );
> &gt; 
> &gt; ...or, if you need SLD based stylings (as I did):
> &gt;  
> &gt; &quot;http://domain/cgi-bin/mapserv?map=/path/to/project.map
> &gt; &lt;http://domain/cgi-bin/mapserv?map=/path/to/project.map&gt;
&quot;,
> &gt; {layers: &quot;landcover&quot;,
> &gt;      SLD: &quot;url-to-your-SLD
&lt;http://geoserver.itc.nl/mapserver/sld/galicia..xml&gt;
> &gt; &quot;}
> &gt;      );
> &gt;  
> &gt; ...and if you want the layer to be an overlay iso. a base layer:
> &gt;  
> &gt; &quot;http://domain/cgi-bin/mapserv?map=/path/to/project.map
> &gt; &lt;http://domain/cgi-bin/mapserv?map=/path/to/project.map&gt;
&quot;,
> &gt; {layers: &quot;landcover&quot;,
> &gt;      SLD: &quot;url-to-your-SLD
&lt;http://geoserver.itc.nl/mapserver/sld/galicia..xml&gt;
> &gt; &quot;,
> &gt;      format: &quot;image/png&quot;,
> &gt;      transparent: &quot;true&quot;}
> &gt;      );
> &gt; --
> &gt; Barend Köbben
> &gt; International Institute for Geo-information Sciences and  Earth
Observation
> &gt; (ITC) PO Box 6, 7500AA Enschede (The Netherlands)
> &gt; ph: +31-(0)534874253; mobile: +31-(0)622344955
> &gt; 
> &gt;  
> &gt; _______________________________________________
> &gt; Users mailing list
> &gt; Users at openlayers.org
> &gt; http://openlayers.org/mailman/listinfo/users
> &gt; 
> &gt; _______________________________________________
> &gt; Users mailing list
> &gt; Users at openlayers.org
> &gt; 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