Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fordecyt_2019
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
fordecyt_2019
Commits
01029e0d
Commit
01029e0d
authored
Mar 09, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove '/data' in routes and calls
parent
afc95448
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
39 additions
and
35 deletions
+39
-35
geobuf.js
geobuf.js
+2
-2
geojson.js
geojson.js
+2
-2
list_layers.js
list_layers.js
+2
-2
mvt.js
mvt.js
+8
-2
centropais_functions.js
public/js/centropais_functions.js
+3
-3
centropais_periurbano.js
public/js/centropais_periurbano.js
+3
-1
cuerpos_functions.js
public/js/cuerpos_functions.js
+2
-1
evolucion_urbana.js
public/js/evolucion_urbana.js
+4
-4
evolucion_urbana_charts.js
public/js/evolucion_urbana_charts.js
+1
-2
grijalva_charts.js
public/js/grijalva_charts.js
+1
-4
grijalva_functions.js
public/js/grijalva_functions.js
+4
-4
riesgos_basemap.js
public/js/riesgos_basemap.js
+1
-2
riesgos_functions.js
public/js/riesgos_functions.js
+4
-4
query.js
query.js
+2
-2
No files found.
geobuf.js
View file @
01029e0d
...
@@ -56,7 +56,7 @@ const sql = (params, query) => {
...
@@ -56,7 +56,7 @@ const sql = (params, query) => {
/**
/**
* @swagger
* @swagger
*
*
* /
data/
geobuf/{table}:
* /geobuf/{table}:
* get:
* get:
* description: return table as geobuf
* description: return table as geobuf
* tags: ['geodata']
* tags: ['geodata']
...
@@ -93,7 +93,7 @@ const sql = (params, query) => {
...
@@ -93,7 +93,7 @@ const sql = (params, query) => {
* 422:
* 422:
* description: invalid datasource or columnname
* description: invalid datasource or columnname
*/
*/
app
.
get
(
'/
data/
geobuf/:table'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/geobuf/:table'
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
query
.
geom_column
)
{
if
(
!
req
.
query
.
geom_column
)
{
req
.
query
.
geom_column
=
'geom'
;
req
.
query
.
geom_column
=
'geom'
;
}
}
...
...
geojson.js
View file @
01029e0d
...
@@ -56,7 +56,7 @@ module.exports = function(app, pool) {
...
@@ -56,7 +56,7 @@ module.exports = function(app, pool) {
/**
/**
* @swagger
* @swagger
*
*
* /
data/
geojson/{table}:
* /geojson/{table}:
* get:
* get:
* description: return table as geojson
* description: return table as geojson
* tags: ['geodata']
* tags: ['geodata']
...
@@ -93,7 +93,7 @@ module.exports = function(app, pool) {
...
@@ -93,7 +93,7 @@ module.exports = function(app, pool) {
* 422:
* 422:
* description: invalid datasource or columnname
* description: invalid datasource or columnname
*/
*/
app
.
get
(
'/
data/
geojson/:table'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/geojson/:table'
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
query
.
geom_column
)
{
if
(
!
req
.
query
.
geom_column
)
{
req
.
query
.
geom_column
=
'geom'
;
req
.
query
.
geom_column
=
'geom'
;
}
}
...
...
list_layers.js
View file @
01029e0d
...
@@ -44,7 +44,7 @@ const sql = () => {
...
@@ -44,7 +44,7 @@ const sql = () => {
/**
/**
* @swagger
* @swagger
*
*
* /
data/
list_layers:
* /list_layers:
* get:
* get:
* description: get list of available tables
* description: get list of available tables
* tags: ['meta']
* tags: ['meta']
...
@@ -88,7 +88,7 @@ const sql = () => {
...
@@ -88,7 +88,7 @@ const sql = () => {
* 500:
* 500:
* description: unexpected error
* description: unexpected error
*/
*/
app
.
get
(
'/
data/
list_layers'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/list_layers'
,
async
(
req
,
res
)
=>
{
try
{
try
{
const
sqlString
=
sql
()
const
sqlString
=
sql
()
const
result
=
await
pool
.
query
(
sqlString
);
const
result
=
await
pool
.
query
(
sqlString
);
...
...
mvt.js
View file @
01029e0d
...
@@ -108,7 +108,7 @@ module.exports = function(app, pool, cache) {
...
@@ -108,7 +108,7 @@ module.exports = function(app, pool, cache) {
/**
/**
* @swagger
* @swagger
*
*
* /
data/
{datasource}/mvt/{z}/{x}/{y}:
* /{datasource}/mvt/{z}/{x}/{y}:
* get:
* get:
* description: get mapbox vector tile (mvt)
* description: get mapbox vector tile (mvt)
* tags: ['geodata']
* tags: ['geodata']
...
@@ -157,7 +157,13 @@ module.exports = function(app, pool, cache) {
...
@@ -157,7 +157,13 @@ module.exports = function(app, pool, cache) {
* 422:
* 422:
* description: invalid datasource or columnname
* description: invalid datasource or columnname
*/
*/
app
.
get
(
'/data/:datasource/mvt/:z/:x/:y'
,
cacheMiddleWare
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/:datasource/mvt/:z/:x/:y'
,
cacheMiddleWare
,
async
(
req
,
res
)
=>
{
var
types
=
require
(
'pg'
).
types
types
.
setTypeParser
(
1700
,
function
(
val
)
{
return
parseFloat
(
val
);
});
if
(
!
req
.
query
.
geom_column
)
{
if
(
!
req
.
query
.
geom_column
)
{
req
.
query
.
geom_column
=
'geom'
;
// default
req
.
query
.
geom_column
=
'geom'
;
// default
}
}
...
...
public/js/centropais_functions.js
View file @
01029e0d
...
@@ -166,10 +166,12 @@ const sortInitialDateAscending = (a, b) => {
...
@@ -166,10 +166,12 @@ const sortInitialDateAscending = (a, b) => {
return
a
-
b
;
return
a
-
b
;
}
}
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
origin
;
// returns "http://localhost:8090"
// use `${baseUrl}/something`
// query available dates on DB
// query available dates on DB
const
setupDates
=
()
=>
{
const
setupDates
=
()
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
layersQuery
=
`
${
baseUrl
}
/list_layers`
;
let
layersQuery
=
`
${
baseUrl
}
/list_layers`
;
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
layers
.
forEach
(
layer
=>
{
layers
.
forEach
(
layer
=>
{
...
@@ -405,7 +407,6 @@ const queryFiles = () => {
...
@@ -405,7 +407,6 @@ const queryFiles = () => {
const
getMinMax
=
table
=>
{
const
getMinMax
=
table
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
resolve
(
minmax
[
0
]);
resolve
(
minmax
[
0
]);
...
@@ -648,7 +649,6 @@ const updateCharts = async() => {
...
@@ -648,7 +649,6 @@ const updateCharts = async() => {
// define MVT layer for given month table and all indicators
// define MVT layer for given month table and all indicators
const
mapboxLayer
=
(
monthYear
)
=>
{
const
mapboxLayer
=
(
monthYear
)
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
pbfLayer
=
{
let
pbfLayer
=
{
id
:
monthYear
,
id
:
monthYear
,
source
:
{
source
:
{
...
...
public/js/centropais_periurbano.js
View file @
01029e0d
...
@@ -17,10 +17,12 @@ let timeDimensionControl,
...
@@ -17,10 +17,12 @@ let timeDimensionControl,
layerControl
,
layerControl
,
tiles
;
tiles
;
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
origin
;
// returns "http://localhost:8090"
// use `${baseUrl}/something`
const
getMinMax
=
table
=>
{
const
getMinMax
=
table
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
//let table = "urbanization_year";
//let table = "urbanization_year";
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
`min(yeartrimes), max(yeartrimes)`
}
`
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
`min(yeartrimes), max(yeartrimes)`
}
`
;
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
resolve
(
minmax
[
0
]);
resolve
(
minmax
[
0
]);
...
...
public/js/cuerpos_functions.js
View file @
01029e0d
...
@@ -63,7 +63,8 @@ d3.json("https://unpkg.com/d3-time-format@2.1.1/locale/es-MX.json").then(async l
...
@@ -63,7 +63,8 @@ d3.json("https://unpkg.com/d3-time-format@2.1.1/locale/es-MX.json").then(async l
const
sortInitialDateAscending
=
(
a
,
b
)
=>
a
-
b
;
const
sortInitialDateAscending
=
(
a
,
b
)
=>
a
-
b
;
// Dates will be cast to numbers automagically:
// Dates will be cast to numbers automagically:
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
origin
;
// returns "http://localhost:8090"
// use `${baseUrl}/something`
// query available dates on DB
// query available dates on DB
const
setupDates
=
()
=>
{
const
setupDates
=
()
=>
{
...
...
public/js/evolucion_urbana.js
View file @
01029e0d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
/* globals Promise */
/* globals Promise */
/* exported layerControl */
/* exported layerControl
, baseUrl
*/
let
timeDimensionControl
,
let
timeDimensionControl
,
map
,
map
,
...
@@ -17,10 +17,11 @@ let timeDimensionControl,
...
@@ -17,10 +17,11 @@ let timeDimensionControl,
layerControl
,
layerControl
,
tiles
;
tiles
;
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
origin
;
// returns "http://localhost:8090"
// use `${baseUrl}/something`
const
getMinMax
=
table
=>
{
const
getMinMax
=
table
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
//let table = "urbanization_year";
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
`min(yeartrimes), max(yeartrimes)`
}
`
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
`min(yeartrimes), max(yeartrimes)`
}
`
;
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
resolve
(
minmax
[
0
]);
resolve
(
minmax
[
0
]);
...
@@ -223,7 +224,6 @@ const populateMap = async(mapData) => {
...
@@ -223,7 +224,6 @@ const populateMap = async(mapData) => {
// define MVT layer for given table and all trimester column
// define MVT layer for given table and all trimester column
const
mapboxLayer
=
(
table
)
=>
{
const
mapboxLayer
=
(
table
)
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
pbfLayer
=
{
let
pbfLayer
=
{
id
:
table
,
id
:
table
,
source
:
{
source
:
{
...
...
public/js/evolucion_urbana_charts.js
View file @
01029e0d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* June 2020 - March 2021
* June 2020 - March 2021
*/
*/
/* globals am4core, am4charts, am4themes_animated */
/* globals am4core, am4charts, am4themes_animated
, baseUrl
*/
// amchart
// amchart
am4core
.
ready
(
function
()
{
am4core
.
ready
(
function
()
{
...
@@ -116,7 +116,6 @@ am4core.ready(function() {
...
@@ -116,7 +116,6 @@ am4core.ready(function() {
}
}
//Add data
//Add data
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
table
=
"urbanization_year"
;
let
table
=
"urbanization_year"
;
let
query
=
`
${
baseUrl
}
/query/
${
table
}
?columns=yeartrimes,sum(area)/10000 as area,date&group=yeartrimes,date&sort=yeartrimes`
;
let
query
=
`
${
baseUrl
}
/query/
${
table
}
?columns=yeartrimes,sum(area)/10000 as area,date&group=yeartrimes,date&sort=yeartrimes`
;
d3
.
json
(
query
).
then
(
d
=>
{
d3
.
json
(
query
).
then
(
d
=>
{
...
...
public/js/grijalva_charts.js
View file @
01029e0d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* August-September 2019
* August-September 2019
*/
*/
/* globals map, userFiles, userDates, indicators, indicatorVars, indicatorsNames */
/* globals map, userFiles, userDates, indicators, indicatorVars, indicatorsNames
, baseUrl
*/
/* exported makeIndicatorGraph, getData, updateData, getDataInSelection */
/* exported makeIndicatorGraph, getData, updateData, getDataInSelection */
let
minDate
,
maxDate
,
xLine
,
yLine
;
let
minDate
,
maxDate
,
xLine
,
yLine
;
...
@@ -26,7 +26,6 @@ const getData = async () => {
...
@@ -26,7 +26,6 @@ const getData = async () => {
data
[
indicator
].
push
({
name
:
`
${
indicator
}
0`
,
values
:
[]});
data
[
indicator
].
push
({
name
:
`
${
indicator
}
0`
,
values
:
[]});
});
});
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
const
userFilePromises
=
userFiles
.
map
(
async
monthYear
=>
{
const
userFilePromises
=
userFiles
.
map
(
async
monthYear
=>
{
let
queryDB
=
`
${
baseUrl
}
/query/
${
monthYear
}
?columns=
${
queryColumns
.
join
(
","
)}
`
;
let
queryDB
=
`
${
baseUrl
}
/query/
${
monthYear
}
?columns=
${
queryColumns
.
join
(
","
)}
`
;
const
dbData
=
await
d3
.
json
(
queryDB
);
const
dbData
=
await
d3
.
json
(
queryDB
);
...
@@ -57,8 +56,6 @@ const getDataInSelection = async () => {
...
@@ -57,8 +56,6 @@ const getDataInSelection = async () => {
data
[
indicator
]
=
[];
data
[
indicator
]
=
[];
});
});
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
// Convert drawn items to GeoJSON and check what's inside each one of them
// Convert drawn items to GeoJSON and check what's inside each one of them
const
drawnItemPromises
=
drawnItems
.
toGeoJSON
().
features
.
map
(
async
(
item
,
i
)
=>
{
const
drawnItemPromises
=
drawnItems
.
toGeoJSON
().
features
.
map
(
async
(
item
,
i
)
=>
{
// set SRID fro drawn features
// set SRID fro drawn features
...
...
public/js/grijalva_functions.js
View file @
01029e0d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
/* globals omnivore, Promise, chroma, makeBaseMap, makeIndicatorGraph, getData, getDataInSelection */
/* globals omnivore, Promise, chroma, makeBaseMap, makeIndicatorGraph, getData, getDataInSelection */
/* exported indicators. userFiles, userDates, timeParse, layerControl, updateCharts */
/* exported indicators. userFiles, userDates, timeParse, layerControl, updateCharts
, baseUrl
*/
let
timeParse
,
let
timeParse
,
timeFormat
,
timeFormat
,
...
@@ -96,10 +96,12 @@ const sortInitialDateAscending = (a, b) => {
...
@@ -96,10 +96,12 @@ const sortInitialDateAscending = (a, b) => {
return
a
-
b
;
return
a
-
b
;
}
}
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
origin
;
// returns "http://localhost:8090"
// use `${baseUrl}/something`
// query available dates on DB
// query available dates on DB
const
setupDates
=
()
=>
{
const
setupDates
=
()
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
layersQuery
=
`
${
baseUrl
}
/list_layers`
;
let
layersQuery
=
`
${
baseUrl
}
/list_layers`
;
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
layers
.
forEach
(
layer
=>
{
layers
.
forEach
(
layer
=>
{
...
@@ -332,7 +334,6 @@ const queryFiles = () => {
...
@@ -332,7 +334,6 @@ const queryFiles = () => {
const
getMinMax
=
table
=>
{
const
getMinMax
=
table
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
resolve
(
minmax
[
0
]);
resolve
(
minmax
[
0
]);
...
@@ -535,7 +536,6 @@ const updateCharts = async () => {
...
@@ -535,7 +536,6 @@ const updateCharts = async () => {
// define MVT layer for given month table and all indicators
// define MVT layer for given month table and all indicators
const
mapboxLayer
=
(
monthYear
)
=>
{
const
mapboxLayer
=
(
monthYear
)
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
pbfLayer
=
{
let
pbfLayer
=
{
id
:
monthYear
,
id
:
monthYear
,
source
:
{
source
:
{
...
...
public/js/riesgos_basemap.js
View file @
01029e0d
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* August-September 2019
* August-September 2019
*/
*/
/* global baseFileSize, formatBytes, Promise, omnivore, JSZip, map, glmap, layerControl, updateCharts */
/* global baseFileSize, formatBytes, Promise, omnivore, JSZip, map, glmap, layerControl, updateCharts
, baseUrl
*/
/* exported makeBaseMap, baseLayerPromises, drawnItems */
/* exported makeBaseMap, baseLayerPromises, drawnItems */
/* Lines related to displaying loading bar are commented */
/* Lines related to displaying loading bar are commented */
...
@@ -518,7 +518,6 @@ let layer_agebsbydens = new L.geoJson(null, {
...
@@ -518,7 +518,6 @@ let layer_agebsbydens = new L.geoJson(null, {
style
:
style_agebsbydens
style
:
style_agebsbydens
});
});
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
layer_agricolapv_fake
=
new
L
.
geoJson
(
null
,
{}),
let
layer_agricolapv_fake
=
new
L
.
geoJson
(
null
,
{}),
layer_agricolaoi_fake
=
new
L
.
geoJson
(
null
,
{});
layer_agricolaoi_fake
=
new
L
.
geoJson
(
null
,
{});
...
...
public/js/riesgos_functions.js
View file @
01029e0d
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*/
*/
/* globals omnivore, Promise, chroma, makeBaseMap, makeIndicatorGraph, getData, getDataInSelection */
/* globals omnivore, Promise, chroma, makeBaseMap, makeIndicatorGraph, getData, getDataInSelection */
/* exported indicators. userFiles, userDates, timeParse, layerControl, updateCharts */
/* exported indicators. userFiles, userDates, timeParse, layerControl, updateCharts
, baseUrl
*/
let
timeParse
,
let
timeParse
,
timeFormat
,
timeFormat
,
...
@@ -96,10 +96,12 @@ const sortInitialDateAscending = (a, b) => {
...
@@ -96,10 +96,12 @@ const sortInitialDateAscending = (a, b) => {
return
a
-
b
;
return
a
-
b
;
}
}
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
origin
;
// returns "http://localhost:8090"
// use `${baseUrl}/something`
// query available dates on DB
// query available dates on DB
const
setupDates
=
()
=>
{
const
setupDates
=
()
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
layersQuery
=
`
${
baseUrl
}
/list_layers`
;
let
layersQuery
=
`
${
baseUrl
}
/list_layers`
;
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
layers
.
forEach
(
layer
=>
{
layers
.
forEach
(
layer
=>
{
...
@@ -332,7 +334,6 @@ const queryFiles = () => {
...
@@ -332,7 +334,6 @@ const queryFiles = () => {
const
getMinMax
=
table
=>
{
const
getMinMax
=
table
=>
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
let
minmaxQuery
=
`
${
baseUrl
}
/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
resolve
(
minmax
[
0
]);
resolve
(
minmax
[
0
]);
...
@@ -535,7 +536,6 @@ const updateCharts = async () => {
...
@@ -535,7 +536,6 @@ const updateCharts = async () => {
// define MVT layer for given month table and all indicators
// define MVT layer for given month table and all indicators
const
mapboxLayer
=
(
monthYear
)
=>
{
const
mapboxLayer
=
(
monthYear
)
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
pbfLayer
=
{
let
pbfLayer
=
{
id
:
monthYear
,
id
:
monthYear
,
source
:
{
source
:
{
...
...
query.js
View file @
01029e0d
...
@@ -27,7 +27,7 @@ module.exports = function(app, pool) {
...
@@ -27,7 +27,7 @@ module.exports = function(app, pool) {
/**
/**
* @swagger
* @swagger
*
*
* /
data/
query/{table}:
* /query/{table}:
* get:
* get:
* description: Query a table or view.
* description: Query a table or view.
* tags: ['api']
* tags: ['api']
...
@@ -69,7 +69,7 @@ module.exports = function(app, pool) {
...
@@ -69,7 +69,7 @@ module.exports = function(app, pool) {
* 422:
* 422:
* description: invalid table or column name
* description: invalid table or column name
*/
*/
app
.
get
(
'/
data/
query/:table'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/query/:table'
,
async
(
req
,
res
)
=>
{
const
sqlString
=
sql
(
req
.
params
,
req
.
query
);
const
sqlString
=
sql
(
req
.
params
,
req
.
query
);
try
{
try
{
const
result
=
await
pool
.
query
(
sqlString
);
const
result
=
await
pool
.
query
(
sqlString
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment