-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assign layer as request param for queries
- Loading branch information
1 parent
4a547b7
commit 7f7495b
Showing
6 changed files
with
26 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
module.exports = _ => { | ||
|
||
const layer = _.workspace.locales[_.locale].layers[_.layer] | ||
const table = _.layer.table || Object.values(_.layer.tables).find(tab => !!tab); | ||
|
||
const table = layer.table || Object.values(layer.tables).find(tab => !!tab); | ||
|
||
const geom = layer.geom || Object.values(layer.geoms).find(tab => !!tab); | ||
const geom = _.layer.geom || Object.values(_.layer.geoms).find(tab => !!tab); | ||
|
||
return ` | ||
SELECT | ||
${layer.qID} as id | ||
${_.layer.qID} as id | ||
FROM ${table} | ||
WHERE ${geom} IS NOT NULL AND ${layer.qID} IS NOT NULL | ||
ORDER BY ${layer.qID} DESC | ||
WHERE ${geom} IS NOT NULL AND ${_.layer.qID} IS NOT NULL | ||
ORDER BY ${_.layer.qID} DESC | ||
LIMIT 1` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
module.exports = _ => { | ||
|
||
const layer = _.workspace.locales[_.locale].layers[_.layer] | ||
|
||
if (!layer.mvt_cache) return; | ||
if (!_.layer.mvt_cache) return; | ||
|
||
return ` | ||
DROP table if exists ${layer.mvt_cache}; | ||
DROP table if exists ${_.layer.mvt_cache}; | ||
Create UNLOGGED table ${layer.mvt_cache} | ||
Create UNLOGGED table ${_.layer.mvt_cache} | ||
( | ||
z integer not null, | ||
x integer not null, | ||
y integer not null, | ||
mvt bytea, | ||
tile geometry(Polygon, ${layer.srid}), | ||
constraint ${layer.mvt_cache.replace(/\./, '_')}_z_x_y_pk | ||
constraint ${_.layer.mvt_cache.replace(/\./, '_')}_z_x_y_pk | ||
primary key (z, x, y) | ||
); | ||
Create index IF NOT EXISTS ${layer.mvt_cache.replace(/\./, '_')}_tile on ${layer.mvt_cache} (tile); | ||
Create index IF NOT EXISTS ${_.layer.mvt_cache.replace(/\./, '_')}_tile on ${_.layer.mvt_cache} (tile); | ||
SELECT '${layer.mvt_cache} cache OK' as msg;` | ||
SELECT '${_.layer.mvt_cache} cache OK' as msg;` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters