[OpenLayers-Users] RE: GisCloud showing tons of vectors features on Web Browser

Greg Allensworth gregor at greeninfo.org
Wed Sep 21 19:54:33 EDT 2011


On 9/21/2011 4:16 PM, Etides wrote:
> Ok but when moving the mouse fastly over the map it really
> highlight the polygon feature under the cursor without
> any query to database so it seems that they really
 > have all the map already loaded in vector format

Nice. This is totally off topic from OpenLayers, though, so if we get 
asked to knock it off, well okay. :)

I'm looking at their site now with Firebug. I heard last week a trick 
which sounded quite similar to what I think I'm seeing here. (thank you 
Dane!)

The short version:

Wax and TileStream and MapBox can apparently provide this sort of 
functionality. Last I heard this new feature was still in the hacking 
stage, but if you're interested, check it out. I know we intend to keep 
tabs on this and get involved as soon as workload permits.

http://developmentseed.org/blog/2011/jun/10/wax-custom-advanced-ui-web-maps/
https://github.com/mapbox/wax

The long version:

The page loads a set of JSON files, each one being a tile.
http://cft1.giscloud.com/t/1316552561/map16581/layer80785/7/63/62.json

The JSON tiles have pixel information basically being 4-point polygons 
of pixels, a style (R, G, B, width), and classification-ID. The 
JavaScript effectively draws these points into the canvas, then provides 
a mouseover callback for those pixels on canvas.

It's much more efficient to and parse 20 JSON documents at 25-75 kB 
apiece than a single 2 MB document (the cost of parsing documents is 
more than linear to size), and several thousand event callbacks are 
lighterweight than several thousand Feature.Vector instances (which are 
basically bloated copies of the document that was just parsed). So skip 
straight to step 3: blit the simple polygons onto canvas and add callbacks.

I'd heard about it in theory, but seeing it in action makes me quite 
hungry to get more involved. I gotta get back to work, empty my inbox, 
and get into TileMill and TileStream...

-- 
Greg Allensworth, Web GIS Developer
BS  A+  Network+  Security+  Linux+  Server+  ZCE-PHP
GreenInfo Network - Information and Mapping in the Public Interest
564 Market Street, Suite 510  San Francisco CA 94104
PH: 415-979-0343 x302  FX: 415-979-0371    email: gregor at greeninfo.org
Web: www.GreenInfo.org     www.MapsPortal.org

Subscribe to MapLines, our e-newsletter, at www.GreenInfo.org


More information about the Users mailing list