-
Notifications
You must be signed in to change notification settings - Fork 18
/
config.js
115 lines (113 loc) · 5.44 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
"use strict";
var canopyBoundarySql = [
"SELECT the_geom_webmercator",
", canopy_percent * 100 as percent",
", FORMAT('%s (%s%%)',",
// Remove parent boundary name suffix.
// Ex. Pittsburgh (Allegheny) -> Pittsburgh
" SPLIT_PART(name, ' (', 1),",
" ROUND(CAST(canopy_percent * 100 AS numeric), 1)) as label",
" FROM treemap_boundary AS b",
" INNER JOIN treemap_instance_boundaries AS ib ON ib.boundary_id = b.id",
" WHERE ib.instance_id = <%= instanceid %>",
" AND b.category = '<%= category %>'",
" AND b.canopy_percent IS NOT NULL",
" AND b.canopy_percent >= <%= canopy_min %>",
" AND b.canopy_percent <= <%= canopy_max %>",
].join('');
module.exports = {
"filterQueryArgumentName": "q",
"displayQueryArgumentName": "show",
"restrictFeatureQueryArgumentName": "restrict",
// This is the column name of the hstore column used for scalar udfs
"scalar_udf_field": "udfs",
"sqlForMapFeatures": {
"fields": {
"geom": {
"point": "the_geom_webmercator",
"polygon": "stormwater_polygonalmapfeature.polygon"
},
"base": "feature_type, treemap_tree.id AS tree_id",
"polygon": "feature_type",
"utfGrid": "feature_type, treemap_mapfeature.id AS id"
},
"basePointModel": "mapFeature",
"basePolygonModel": "polygonalMapFeature",
// The tables object gets walked by filtersToTables to build the FROM and JOIN clauses of the SQL string.
// The "depends" property of each item should include any tables used in the "sql" property to JOIN to that table
"tables": {
"mapFeature": {
"depends": [],
"sql": "treemap_mapfeature"
},
"polygonalMapFeature": {
"depends": ["mapFeature"],
"sql": "LEFT OUTER JOIN stormwater_polygonalmapfeature ON stormwater_polygonalmapfeature.mapfeature_ptr_id = treemap_mapfeature.id"
},
"plot": {
"depends": ["mapFeature"],
"sql": "JOIN treemap_plot ON treemap_mapfeature.id = treemap_plot.mapfeature_ptr_id"
},
"rainBarrel": {
"depends": ["mapFeature"],
"sql": "JOIN stormwater_rainbarrel ON treemap_mapfeature.id = stormwater_rainbarrel.mapfeature_ptr_id"
},
"rainGarden": {
"depends": ["mapFeature"],
"sql": "JOIN stormwater_raingarden ON treemap_mapfeature.id = stormwater_raingarden.polygonalmapfeature_ptr_id"
},
"bioswale": {
"depends": ["mapFeature"],
"sql": "JOIN stormwater_bioswale ON treemap_mapfeature.id = stormwater_bioswale.polygonalmapfeature_ptr_id"
},
"tree": {
"depends": ["mapFeature"],
"sql": "LEFT OUTER JOIN treemap_tree ON treemap_mapfeature.id = treemap_tree.plot_id"
},
"species": {
"depends": ["mapFeature", "tree"],
"sql": "LEFT OUTER JOIN treemap_species ON treemap_tree.species_id = treemap_species.id"
},
"mapFeaturePhoto": {
"depends": ["mapFeature"],
"sql": "LEFT OUTER JOIN treemap_mapfeaturephoto ON treemap_mapfeature.id = treemap_mapfeaturephoto.map_feature_id"
},
"udf": {
// Despite mapFeature not being referenced in the "sql" property it will
// be used in the filter for udf and so it is required
"depends": ["mapFeature"],
// udf uses a CROSS JOIN, but in filterObjectToWhere a restrictive WHERE clause is added
"sql": "CROSS JOIN treemap_userdefinedcollectionvalue"
}
},
"where": {
"instance" : "treemap_mapfeature.instance_id = <%= instanceid %>"
}
},
"treeDisplayFilters": ["EmptyPlot", "Tree"],
"boundaryGrainstoreSql": "SELECT the_geom_webmercator FROM treemap_boundary JOIN treemap_instance_boundaries ON treemap_instance_boundaries.boundary_id = treemap_boundary.id WHERE treemap_instance_boundaries.instance_id=<%= instanceid %> AND treemap_boundary.searchable=true",
"getBoundarySql" : "SELECT the_geom_webmercator FROM treemap_boundary WHERE id=<%= boundaryId %>",
"canopyBoundarySql": canopyBoundarySql,
"showAtZoomSql": "(treemap_mapfeature.hide_at_zoom IS NULL OR treemap_mapfeature.hide_at_zoom < <%= zoom %>)",
"customDbFieldNames": {
"geom": "the_geom_webmercator"
},
"interactivityForUtfGridRequests": "id",
"modelMapping": {
"mapFeature": "treemap_mapfeature",
"polygonalMapFeature": "stormwater_polygonalmapfeature",
"tree": "treemap_tree",
"plot": "treemap_plot",
"rainBarrel": "stormwater_rainbarrel",
"rainGarden": "stormwater_raingarden",
"bioswale": "stormwater_bioswale",
"species": "treemap_species",
"mapFeaturePhoto": "treemap_mapfeaturephoto",
"udf": "treemap_userdefinedcollectionvalue"
},
"udfcTemplates": {
"tree": "treemap_userdefinedcollectionvalue.field_definition_id=<%= fieldDefId %> AND treemap_userdefinedcollectionvalue.model_id=treemap_tree.id",
"mapFeature": "treemap_userdefinedcollectionvalue.field_definition_id=<%= fieldDefId %> AND treemap_userdefinedcollectionvalue.model_id=treemap_mapfeature.id",
},
"treeMarkerMaxWidth": 20
};