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
c084626a
Commit
c084626a
authored
Sep 04, 2019
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix API call base URLs
parent
f0a41af8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
grijalva_charts.js
public/js/grijalva_charts.js
+2
-2
grijalva_functions.js
public/js/grijalva_functions.js
+4
-3
No files found.
public/js/grijalva_charts.js
View file @
c084626a
...
...
@@ -27,7 +27,7 @@ const getData = async () => {
});
const
userFilePromises
=
userFiles
.
map
(
async
monthYear
=>
{
let
queryDB
=
`
http://localhost:8090
/data/query/
${
monthYear
}
?columns=
${
queryColumns
.
join
(
","
)}
`
;
let
queryDB
=
`
..
/data/query/
${
monthYear
}
?columns=
${
queryColumns
.
join
(
","
)}
`
;
const
dbData
=
await
d3
.
json
(
queryDB
);
return
{
date
:
timeParse
(
monthYear
),
value
:
dbData
[
0
]};
});
...
...
@@ -67,7 +67,7 @@ const getDataInSelection = async () => {
let
filter
=
`ST_Intersects(geom, (SELECT ST_Multi(ST_GeomFromGeoJSON('
${
JSON
.
stringify
(
geojson
.
features
[
i
].
geometry
)}
') ) ) )`
const
userFilePromises
=
userFiles
.
map
(
async
monthYear
=>
{
let
queryData
=
`
http://localhost:8090
/data/query/
${
monthYear
}
?columns=
${
queryColumns
.
join
(
","
)}
&filter=
${
filter
}
&group=1%3D1`
;
let
queryData
=
`
..
/data/query/
${
monthYear
}
?columns=
${
queryColumns
.
join
(
","
)}
&filter=
${
filter
}
&group=1%3D1`
;
const
selectionQuery
=
await
d3
.
json
(
queryData
);
return
{
date
:
timeParse
(
monthYear
),
value
:
selectionQuery
[
0
]};
});
...
...
public/js/grijalva_functions.js
View file @
c084626a
...
...
@@ -99,7 +99,7 @@ const sortInitialDateAscending = (a, b) => {
// query available dates on DB
const
setupDates
=
()
=>
{
return
new
Promise
(
resolve
=>
{
let
layersQuery
=
"
http://localhost:8090
/data/list_layers"
;
let
layersQuery
=
"
..
/data/list_layers"
;
d3
.
json
(
layersQuery
).
then
(
layers
=>
{
layers
.
forEach
(
layer
=>
{
dateArray
.
push
(
timeParse
(
layer
.
f_table_name
));
// convert filenames to dates
...
...
@@ -331,7 +331,7 @@ const queryFiles = () => {
const
getMinMax
=
table
=>
{
return
new
Promise
(
resolve
=>
{
let
minmaxQuery
=
`
http://localhost:8090
/data/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
let
minmaxQuery
=
`
..
/data/query/
${
table
}
?columns=
${
cols
.
join
(
", "
)}
`
;
d3
.
json
(
minmaxQuery
).
then
(
minmax
=>
{
resolve
(
minmax
[
0
]);
});
...
...
@@ -526,11 +526,12 @@ const updateCharts = async () => {
// define MVT layer for given month table and all indicators
const
mapboxLayer
=
(
monthYear
)
=>
{
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
pbfLayer
=
{
id
:
monthYear
,
source
:
{
type
:
"vector"
,
tiles
:
[
`
http://localhost:8090/data
/
${
monthYear
}
/mvt/{z}/{x}/{y}?geom_column=geom&columns=
${
indicators
.
join
()}
`
],
tiles
:
[
`
${
baseUrl
}
/
${
monthYear
}
/mvt/{z}/{x}/{y}?geom_column=geom&columns=
${
indicators
.
join
()}
`
],
maxzoom
:
14
,
minzoom
:
5
},
...
...
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