Hey Matt, Thanks for this great contribution. It's been high on my list of desires to get UTFGrid support into OpenLayers, and it looks like you have done a nice job of it.
After a quick preliminary review, I do have a few comments. First, we'll need some tests to go along with this addition. Beyond that, I've got some suggestions about the layer API that I hope you'll be amenable to. I think it would make sense to provide a method on the layer to get attribute data for a map location. This functionality is currently in the control, but can see situations where it would be useful to access this and awkward to have to add a control. I'll provide a pull request for this and some additional tweaks. Note that my pull request will look a lot smaller if you merge the latest master into your utfgrid branch. In addition, I'd like to add support for highlighting regions in the grid. I've got a plan for doing this, and while I don't want to hold up inclusion of the existing functionality, I do think the highlight functionality might inform a bit more how things could be structured. I'll leave more comments on your pull request. Tim On Thu, Feb 16, 2012 at 12:08 PM, Matt Perry <[email protected]> wrote: > Hey all - I'm excited to share my implementation of OpenLayers support > for UTFGrids. I wanted to get some feedback before doing a pull > request. > > Just a little background: UTFGrids are json "hit grids" used to > provide a high degree of interactivity. For example, you can have > mouseover events that display the attributes of the features *without* > fetching additional data from the server. The best demo of the concept > is probably http://mapbox.com/demo/visiblemap/. > > This functionality exists in the wax library and is largely deployed > with ModestMaps. I've ported it to native OpenLayers code to better > integrate with OL event handlers and such. There are three additional > components: a UTFGrid Layer, Control and Tile. It has both ajax and > jsonp loading protocols, tries to keep a clear separation between the > grid layers, the grid controls and callbacks which allows things like > multiple handlers and multiple hit grids per map. > > Some example code: > var world_utfgrid = new OpenLayers.Layer.UTFGrid( > 'UTFGrid Layer', > "http://tiles.example.com/world_utfgrid/${z}/${x}/${y}.json" > ); > map.addLayer(world_utfgrid); > > var control = new OpenLayers.Control.UTFGrid({ > 'div': 'attrsdiv', > 'layers': [world_utfgrid], > 'handlerMode': 'move' > }) > map.addControl(control); > > > Some demos: > http://labs.ecotrust.org/utfgrid/events.html > http://labs.ecotrust.org/utfgrid/multi.html > > and source: > https://github.com/perrygeo/openlayers/tree/utfgrid > > Any thoughts on getting this into 2.12? This is my first substantial > effort in extending OpenLayers so if you have any critiques or > concerns that need to be addressed before a pull request would be > considered, let me know. > -- > ·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º> > "The best way to predict the future is to invent it." -- Alan Kay > Matthew T. Perry > http://www.perrygeo.net > http://viedevelo.wordpress.com > _______________________________________________ > Dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-dev -- Tim Schaub OpenGeo http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-dev
