[OpenLayers-Users] marker implementation using images ?

Alessandro Ferrucci alessandroferrucci at gmail.com
Sun Jul 24 13:39:16 EDT 2011


Hello,
I just wanted to report that we've implemented a very scalable
solution for "immediate" rollover/popup effect over WMS points.

Here is the implementation details.

The map makes 2 different reuqests.  One is a standard WMS request for
the raster of the points.  The other is a custom OWS request to
geoserver.  The OWS request takes a bounding box and a layer name and
returns a JSON snippet with all the points, (with the dimension of the
point as is drawn by the WMS server, in that bounding box for that
layer along with a "place name".  When the client receives the JSON
back, it splits up the screen into a "virtual" grid of 10x10 boxes,
and assigns each point to a "grid cell" on the screen.

The map also has a mouse handler.  Whenever the mouse is moved I
calculate which "virtual grid" the mouse is in within the screen (I
check the y first, then target the x within that row), then I perform
a search through all the points in that grid to see if the mouse falls
within the bounding box (given by lon/lat and drawn point dimension)
of a point, if the mouse is over a point then I change the mouse
pointer and draw a popup with the "place name".

The splitting of the screen speeds up the mouse handler because upon
the mouse moving I don't have to search through all the points on the
screen (potentially thousands), but I only have to search through a
subset of the points (roughly 1% of the returned points if we assume
an even distribution of points).

While the initial assignment is roughly 5 milliseconds slower by
assigning points to the virtual grids, this is offset by the fact that
the mouse handler is much better suited to handle many more points
without causing the mouse to potentially slow down.  Plus, the user
does a lot more "moving around of the mouse" on a given area than they
do zooming in and out of the map.

Cheers,
Alessandro Ferrucci


On Thu, Jul 7, 2011 at 9:36 PM, Phil Scadden <p.scadden at gns.cri.nz> wrote:
> Look more closely at the Net returns. The GET requests to mapslt?layers
> are the images, but intertwined with that are per tile (I think) calls
> to GET ft?layers which return feature information in JSONP format. You
> could do something very similar by making WFS BBOX queries to return
> features, but you notice that what is being returned obviously has some
> filtering mechanism to limit the no. of features return. (Look at the
> returns for whole world versus a zoomed in part). Your hover mechanism
> to search points runs out of grunt when over 500 features returned
> because they have to be all stored in memory and linearly searched.
>
> You get some sort of thing with vector file in openlayers  (Mapbox does
> it with single layer KML files).
>
> Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
Signed,
Alessandro Ferrucci


More information about the Users mailing list