Hotels | Carte generale |
|
|
A basic way to filter markers, is dividing them to different categories and equipping the sidebar with checkboxes. We can read the marker data from separate csv text files for each category. Also we can read many categories from a single file that has a category data cell for each marker.
- A new
SideBar() class was introduced
var myBar = new SideBar(); creates a sidebar
var myCat = new BarCategory(); creates a category in sidebar
- You can add entries to either of them by
addEntry(); method
The basic steps of the script:
ajaxLoad(url,opts) downloads a csv text file by GDownloadUrl() .
- The file is parsed by
.parseCsv() and passed to map.populate(points) .
GMap2.populate(); takes points array as parameter. It creates markers and calls createInfoWindow(point) and SideBar.addEntry(point) .
- If 'cat' or 'iCat' option is specified,
populate() will create the categories needed.
- Copy/paste the script to a page with "map" and "sidebar" blocks.
- Include some CSV text file in the same directory and ajaxLoad() them in the code
More experiments
|
Blog
|