azavea/OTM2-tiler — pull request #16 by RickMohr (2013-07-30 19:38:26+00:00)
Title: Return species_id and support queries in "plot" UTF grid requests

For "plot" UTF grid requests:
* The "interactivity" now contains both the plot ID and (if available) species ID.
* Plot queries are now handled. This required using explicit SELECT columns instead of '*' (because the plot ID column "id" is ambiguous when several tables are joined)

In addition, refactor SQL creation

* Break plots "select" clause into "fields" and "tables"
* In config, combine "plots" properties under "sqlForPlots" and include more pieces of the final SQL
* Fix up tests
* Add makeSql.js as separate module

Note also a bug fix: sqlForPlots.tables.tree now does a LEFT JOIN on the species table instead of a JOIN. That's because when searching for trees we want to get trees without species. With JOIN (aka INNER JOIN) we wouldn't.