[OpenLayers-Users] Add background features to map

maven apache apachemaven0 at gmail.com
Mon Jul 14 20:09:10 PDT 2014


Hi:

We tried to add some background features to the map, while I  say
"background features" I mean features that are not added to the map
directly but will be visible when hovered.

Take the google map for example: http://i.imgur.com/z170Qcx.png, when the
mouse is not hit with the feature(a point in the example) nothing will
happen, but once your mouse have a interception with the feature, a instant
response will be given(show a label in thi example).

Now we have a lot features to be added to the map which is not proper to
added to map once for all, since we have almost 5000+ polygons, 6000+
polygons and 20k+ points which cover a wide map extent, so it would be a
nightmare if we add all of the to the map once.

And we provide one web service to serve the data by tile: "
http://localhost/tile/z/x/y.geojson?layer=......", also we plan to provider
another service "http://localhost/features?bbox=........"

So we have two strategies:

1 Make the data bound with the tile

  1.1 Load the response data for each tile once the tile itself is loaded
which means we resister the 'loadend' event to the tile object for the grid
layer.

  1.2 Register 'move` event to the map object, and to detect if the mouse
hit a loaded feature,  if true, give some response (like adding the feature
to the map on the fly), remove the feature once mouse moved out of the
feature.

2 Make the data bound with the map viewport

  2.1 Register the `moveend` event to the map object, and load features
accordingly.

  2.2 Do the hit detect job like 1.2


Both the two manners have pros and cons:

It will be nice for caching once we use strategy 1, since  we can use
"tile.x-tile.y-tile.z" as the cache key while the `bbox` is not proper to
cache.

And strategy 1 will reduce the load of the server, since the data are bound
with the tile, so if not extra tile are loaded, no features will be
requested, while the strategy 2 not, which will send new request to server
to load features even there is a slight move for the viewport.

However we have to combine features with same identified but cross
different tiles which would be a hard job.

So I ask the question and want to get some suggestion from you processional
guys by the perspectives of  feasibility, performance and etc.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140715/68318a62/attachment.html>


More information about the Users mailing list