wboykinm / mecmaps

Code Base for DAI MEC Mapping portals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor LayerActions

wboykinm opened this issue · comments

Looks like layeractions can be removed entirely given the commonality of the SQL and cartocss. follow this example, and add variables for year and layer id. Then populate layerOptions with the variables.

The one trick is to get a layer reload onclick, in the onload context. Above example seems to do that.

The above example uses createVis, which doesn't work as well here. This might be the way to go instead:

layers[0].setOptions({
  query: "SELECT * FROM {{table_name}} WHERE megacity = 1",
  tile_style: "#{{table_name}}{ marker-fill: black; }"
});

Waaaaaaay down at the bottom of the script so it reloads onclick? Maybe?

Woot. Works w/ Andrew's example using updateQuery()