[OpenLayers-Users] Newbie question - displaying layer of text objects on a map

Andreas Hocevar ahocevar at opengeo.org
Wed Mar 25 06:13:36 EDT 2009


Hi,

Andrew Smith wrote:
> On Mon, Mar 23, 2009 at 5:45 AM, Andreas Hocevar <ahocevar at opengeo.org 
> <mailto:ahocevar at opengeo.org>> wrote:
> 
>     Hi,
> 
>     2009/3/22 Andrew Smith <laconical at gmail.com
>     <mailto:laconical at gmail.com>>:
>      > Andreas, you mentioned that if my data was in PostGIS I could use
>     either a
>      > WMS or WFS to get the data.  If I went down the WMS path, I would
>     have one
>      > WMS for my base map layer, and another one for my text objects
>     layer.  My
> 
>     You could also combine these into one set of image tiles. WMS has a
>     layers parameter. So if your wms layer params has something like
> 
>     params.layers=["mybaselayer","myoverlay"];
> 
>     in it, both will be rendered in one image, with the overlay not
>     occluding the base layer.
> 
> 
> This would be a good idea if the text data I wanted to show was static, 
> but unfortunately it'll be changing every 5 seconds or so. If I 
> integrated the base map and the text into one set of image tiles, the 
> browser would need to reload all image tiles regularly to get the 
> updated data. If the text objects are on their own layer, then the 
> server will be doing less work to regenerate just the text images 
> (parsing less data from PostGIS), and hopefully the refresh will be 
> reasonably smooth because the base layer isn't changing. That's what I'm 
> hoping anyway.  I assume there are no performance implications I need to 
> worry about if I'm redrawing a layer every 5 seconds?  My guess is that 
> OpenLayers is not typically used to show data that changes so quickly.

This should be no problem. There are even ways to avoid flicker: you can 
have two layers pointing to your dynamically changing data. You refresh 
layer 1, make it visible, and turn off layer 2 a second later or so. For 
the next refresh, you do the same procedure with layer 2 and layer 1.

>      > understanding is that the text WMS would return a tile map of
>     images which
>      > would be largely empty space with the occasional text value here
>     and there.
>      > I guess this layer would be transparent so as not to occlude the
>     underlying
>      > map images.
> 
>     That's correct, you would have to add the transparent=true param for
>     the overlay.
> 
>      > Meanwhile, the WFS would return the details about the text
>      > labels and rely on OpenLayers to actually render the vector
>     representations.
> 
>     You can also get the details of text labels using a WMS
>     GetFeatureInfo request.
> 
> 
> 
>      > You mentioned that WMS would be preferred if there were a 'huge
>     number of
>      > features' - I'm surprised that creating all those image tiles on
>     the server
>      > side is faster than adding x vector objects on the browser side
>     (I will
>      > probably have a few dozen at most). Is there a certain point
>     where it just
>      > makes more sense to do it on the server based on the number of
>     objects you
>      > want to displa
> 
>     If you expect the number of your point to grow beyond ~100, you'll
>     definitely be better off using WMS (especially if your users are on
>     Internet Explorer).
> 
> 
> I assume this is because SVG is not used when rendering vector objects 
> in IE, so there's a lot more overhead in showing vectors in that browser?

Basically the overhead _should_ be the same in SVG and VML, because in 
either case we render OpenLayers.Geometry objects, and not SVG. But 
practically, VML needs more workarounds for the same things to be 
accomplished than SVG, and it seems to be slower overall.

Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list