私はマップにcsvデータでドットを入れようとしています。 CSVの 私はフィールドの緯度と経度を持っています... どうすればいいですか? おそらくcsvから配列を取得し、それを使用しますか? ここ..JavaScriptのcsvファイルからデータを読み取る
を、私は、多くのことを試してみましたが、何も働いていないが、私のコードです:
<!DOCTYPE HTML>
<html>
<head>
<script src="http://www.webglearth.com/v2/api.js"></script>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
function initialize() {
var earth = new WE.map('earth_div');
WE.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(earth);
//get the csv file data, create new marker [latitude,longitude]
//the bind popup will get the field country
for (var i = 0; i < 5; i++)
{
var marker = WE.marker([i,i]).addTo(earth);
marker.bindPopup("<b>The data </b><br><a target=_blank href='http://www.google.com'>link</a>.<br />"
, { maxWidth: 150, closeButton: true }).closePopup();
}//end for i
var markerCustom = WE.marker([50, -9], '/img/logo-webglearth-white-100.png', 100, 24).addTo(earth);
earth.setView([0, 0], 3);
}
</script>
<style>
html, body {
padding: 0;
margin: 0;
background-color: black;
}
#earth_div {
top: 0;
right: 0;
bottom: 0;
left: 0;
position: absolute !important;
}
</style>
<title>WebGL Earth API: Markers</title>
</head>
<body onload="initialize()">
<div id="earth_div"></div>
</body>
</html>
地図 – moh89
私のためのコードを書くことができますか?私はどのようにわからない... – Nadav
[リンク](https://stackoverflow.com/questions/7431268/how-to-read-data-from-csv-file-using-javascript)これを見ることができます。 – moh89