<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
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.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Take the google map for example: <a href="http://i.imgur.com/z170Qcx.png">http://i.imgur.com/z170Qcx.png</a>, 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).</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">And we provide one web service to serve the data by tile: "<a href="http://localhost/tile/z/x/y.geojson?layer=.....">http://localhost/tile/z/x/y.geojson?layer=.....</a>.", also we plan to provider another service "<a href="http://localhost/features?bbox=.......">http://localhost/features?bbox=.......</a>."</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">So we have two strategies:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">1 Make the data bound with the tile</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
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.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"> 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. <br>
</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">2 Make the data bound with the map viewport</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"> 2.1 Register the `moveend` event to the map object, and load features accordingly.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"> 2.2 Do the hit detect job like 1.2</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Both the two manners have pros and cons:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
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.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">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.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">However we have to combine features with same identified but cross different tiles which would be a hard job.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">So I ask the question and want to get some suggestion from you processional guys by the perspectives of feasibility, performance and etc.</div>
<div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thanks</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div>