Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DENUE tiles
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
DENUE tiles
Commits
3048d545
Commit
3048d545
authored
Dec 17, 2020
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use fetch api instead of d3.json
parent
f7184c9e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
index.html
public/index.html
+1
-1
functions.js
public/js/functions.js
+3
-2
No files found.
public/index.html
View file @
3048d545
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<body>
<body>
<div
id=
"mexmap"
></div>
<div
id=
"mexmap"
></div>
<script
src=
"https://d3js.org/d3.v5.min.js"
></script>
<script
src=
"https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"
></script>
<script
src=
"https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"
></script>
<script
src=
"../js/functions.js"
></script>
<script
src=
"../js/functions.js"
></script>
</body>
</body>
...
...
public/js/functions.js
View file @
3048d545
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* November-December 2020
* November-December 2020
*/
*/
/* global mapboxgl
, d3
*/
/* global mapboxgl */
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
selectedMunis
=
[
"09002"
,
"09012"
];
let
selectedMunis
=
[
"09002"
,
"09012"
];
...
@@ -168,7 +168,8 @@ map.on("click", "denue", async e => {
...
@@ -168,7 +168,8 @@ map.on("click", "denue", async e => {
if
(
features
.
length
!=
0
)
{
if
(
features
.
length
!=
0
)
{
let
denue_cve
=
features
[
0
].
properties
[
"denue_cve"
];
let
denue_cve
=
features
[
0
].
properties
[
"denue_cve"
];
let
denueQuery
=
`
${
baseUrl
}
/query/dim_denue2019?columns=denue_nombre&filter=denue_cve=
${
denue_cve
}
`
;
let
denueQuery
=
`
${
baseUrl
}
/query/dim_denue2019?columns=denue_nombre&filter=denue_cve=
${
denue_cve
}
`
;
let
denueData
=
await
d3
.
json
(
denueQuery
);
const
response
=
await
fetch
(
denueQuery
);
const
denueData
=
await
response
.
json
();
new
mapboxgl
.
Popup
()
new
mapboxgl
.
Popup
()
.
setLngLat
(
e
.
lngLat
)
.
setLngLat
(
e
.
lngLat
)
.
setHTML
(
denueData
[
0
].
denue_nombre
)
.
setHTML
(
denueData
[
0
].
denue_nombre
)
...
...
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