javascript - How to design a Map application with Backbone? -


so want build map application backbone(probably using leaflet.js). have few ideas on how design this, , wondering if there common design pattern on how this.

the map integrated other visualizations - example if select marker on map happen in visualization. must able conduct geo-searches on markers in map.

there 2 ways thought of doing -

1.have backbone model per marker, have collection of markers, have map view works on collection. whenever collection changes, re-render map.

2.have model called mapmodel holds json, , have data function filters json (based on geosearch or something). map renders json.

the advantage of 1 think easy selections, map may deal tens of thousands, hundreds of thousands of objects, feel things very slow.

is there way this, or 1 of 2 ideas i've had preferable?

thanks

i've been working on same problem, not claim have found "common design pattern", can tell did.

i created mapmodel contains info necessary make map: instance collection of stores if want put stores on map.

then created view of map no collection of markers: problem group of markers in leaflet supposed grouped in l.layergroup class (for instance control when added or removed - example). feels clumsy have markers in layergroup , in collection disguised models.

so created layergroup holding markers, layer being property of mapview. if app complex, may create subview each layer.

when want filter filter on model, easy since it's backbone collection, render view.

my map may deal tens of thousands, hundreds of thousands of objects

that's problematic. it's impossible place such huge number of markers on webmap, should plan how deal (a popular plugin)


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -