about summary refs log tree commit diff
path: root/bh20simplewebuploader/static
diff options
context:
space:
mode:
authorPjotr Prins2020-06-18 15:16:24 +0200
committerGitHub2020-06-18 15:16:24 +0200
commit1554fb6b4daf263f034d46a5f5b26ebcc3e69d22 (patch)
tree688403560941fae8b1b9115b029c8b5bfcf8b042 /bh20simplewebuploader/static
parente5daaefe32379a22abfd332ee3ba7c139efb8458 (diff)
parenta56475f2b869962dcf7bbad276db1553fef203ab (diff)
downloadbh20-seq-resource-1554fb6b4daf263f034d46a5f5b26ebcc3e69d22.tar.gz
bh20-seq-resource-1554fb6b4daf263f034d46a5f5b26ebcc3e69d22.tar.lz
bh20-seq-resource-1554fb6b4daf263f034d46a5f5b26ebcc3e69d22.zip
Merge pull request #84 from BonfaceKilz/master
fix: show missing markers
Diffstat (limited to 'bh20simplewebuploader/static')
-rw-r--r--bh20simplewebuploader/static/main.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/bh20simplewebuploader/static/main.js b/bh20simplewebuploader/static/main.js
index f2e5d99..a9dfc10 100644
--- a/bh20simplewebuploader/static/main.js
+++ b/bh20simplewebuploader/static/main.js
@@ -32,16 +32,17 @@ function fetchAPI(apiEndPoint) {
       return response.json();
     })
     .then(data => {
+        console.log(data);
       markers.clearLayers();
       document.getElementById("results").classList.remove("invisible");
       document.getElementById("loader").classList.add("invisible");
       if (!(apiEndPoint === "/api/getAllaccessions")) {
         for (let i = 0; i < data.length; i++) {
-          let {"Fasta Count": fastaCount, GPS, LocationLabel: label } = data[i];
-          let coordinates = GPS.match(/Point\((-?[0-9]+(?:.(?:[0-9]+)?)?) (-?[0-9]+(?:.(?:[0-9]+)?)?)\)/);
+          let {"count": fastaCount, GPS, LocationLabel: label } = data[i];
+          let coordinates = GPS.split(" ");
           if (!(coordinates == null)) {
             let lat, lon;
-            [lon, lat] = coordinates.slice(1, 3).map(parseFloat);
+            [lon, lat] = coordinates.map(parseFloat);
             let point = L.point()
             let marker = L.marker([lat, lon]);
             marker.bindPopup("<b>" + label + "</b><br/>" + "FastaCount: " +fastaCount);
@@ -279,4 +280,4 @@ fetch(scriptRoot + "api/getCountByGPS")
       }
 
       });
-}
\ No newline at end of file
+}