3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Openlayers3でタイル地図をHTTP/HTTPS選択して取得する方法

Last updated at Posted at 2014-11-07

簡単なタイル地図取得方法

tile.js
//タイル地図の取得
var raster = new ol.layer.Tile({
  source: new ol.source.Stamen({
    layer: 'toner'
  })
});

//地図にタイルをセット
var map = new ol.Map({
  layers: [raster],
  target: 'map',
  view: new ol.View({
    center: [0, 0],
    zoom: 2
  })
});

HTTP/HTTPSを選択してタイル地図を取得する方法

tile.js
//タイル地図の取得
//urlでhttpとhttpsを切り替える事で変更可能
var raster = new ol.layer.Tile({
  source: new ol.source.XYZ({
    url: 'http://{a-d}.tile.stamen.com/toner/{z}/{x}/{y}.png'
  })
});
3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?