Commit 3048d545 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Use fetch api instead of d3.json

parent f7184c9e
...@@ -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>
......
...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment