LoginSignup
0
0

More than 3 years have passed since last update.

leafletを鍛える。その11

Last updated at Posted at 2018-10-25

概要

leafletを鍛えてみた。
d3のv4でjsonよんでみた。

写真

参考にしたページ

サンプルコード

var map = L.map('map').setView([35.7, 139.7], 3);
var mapLink = '<a href="http://openstreetmap.org">OpenStreetMap</a>';
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '&copy; ' + mapLink + ' Contributors',
    maxZoom: 18,
}).addTo(map);


d3.json("http://jsrun.it/assets/Q/w/7/T/Qw7TW", function(error, json) {
    var data = json.results.bindings;
    data.forEach(function(d, i) {
        if (d.lat.value != null && d.long.value != null) 
        {
            var title = d.name.value;
            var mark = L.marker(([d.lat.value, d.long.value]), {
                title: title
            }).addTo(map);
        } 
    });
});


成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0