diff --git a/.DS_Store b/.DS_Store index c82819d..f2b2710 100644 --- a/.DS_Store +++ b/.DS_Store Binary files differ diff --git a/csvmap.html b/csvmap.html new file mode 100644 index 0000000..b2db090 --- /dev/null +++ b/csvmap.html @@ -0,0 +1,20 @@ + + + +Locations + + + + + + +

CSVからの地図作成

+
+ + + + + \ No newline at end of file diff --git a/csvmap.js b/csvmap.js new file mode 100644 index 0000000..75e35b3 --- /dev/null +++ b/csvmap.js @@ -0,0 +1,21 @@ +function myInit() { + /* 北緯38.891度, 東経139.824度, ズームレベル16 で地図表示 */ + var mymap = L.map("csvmap").setView([38.891, 139.824], 16); + L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + attribution: + '© OpenStreetMap contributors' + }).addTo(mymap); + L.control.scale().addTo(mymap); + fetch("experience.csv").then((resp) => { + return resp.text(); // HTTPレスポンスから文字列を抜き出して返す + }).then((csvlines) => { // それを csvlines として受け取る + /* ここに csvlines を複数のCSV行として処理するものを書く */ + var line, x, lon, lat, desc; + for (line of csvlines.split("\n")) { + x = line.split(","); + lon = x[0], lat = x[1], place = [2]; + L.marker([lat, lon]).bindPopup(place).addTo(mymap); + } + }); +} +document.addEventListener("DOMContentLoaded", myInit, false); \ No newline at end of file diff --git a/experience.csv b/experience.csv new file mode 100644 index 0000000..9a32a4f --- /dev/null +++ b/experience.csv @@ -0,0 +1,5 @@ +Latitude,Longitude,Placename +38.890338611,139.830531667,ノスリ +38.926641944,139.854594167,アオサギ +38.904470556,139.832354444,ミサゴ +38.889191389,139.816403056,チゴモズ diff --git a/fetch.html b/fetch.html index ddba95c..4ba59db 100644 --- a/fetch.html +++ b/fetch.html @@ -29,7 +29,7 @@ pre.textContent = txt; // pre要素の内容をそれに置き換える }); if fetch(file.uuu.txt).then - return <>そんなファイルありません + return そんなファイルありません }); diff --git a/scope.rb b/scope.rb deleted file mode 100755 index efb5abf..0000000 --- a/scope.rb +++ /dev/null @@ -1,7 +0,0 @@ -var a=5; -function foo() { - var a=3; - console.log("a="+a); -} -foo(); -console.log("a="+a); \ No newline at end of file