<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>VectorTileLayer</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.10/esri/themes/light/main.css"
/>
<script src="https://js.arcgis.com/4.10/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/VectorTileLayer",
"esri/widgets/Attribution"
], function(Map, MapView, VectorTileLayer, Attribution) {
// ArcGIS Online のキャンバス (ライト グレー) ベースマップを表示するマップを作成
var map = new Map({basemap:"gray-vector"});
// マップと中心座標とズーム率を指定してマップビューを作成
var view = new MapView({
container: "viewDiv",
map: map,
center: [139.745433, 35.658581],
zoom: 6
});
// スタイルファイルの JSON を参照してベクタータイル レイヤーを作成
var vtLayer = new VectorTileLayer({
url:
"https://gist.githubusercontent.com/yozaw/63f5eb0b0d490778ce5082926a49e732/raw/a05d3d8e72ca26fbe02a45e86786f1a676cadc89/style.json",
});
// 作成したベクタータイル レイヤーをマップに追加
map.add(vtLayer);
view.watch('ready', function(){
var attribution = view.ui._components[0];
attribution.widget.watch('attributionText', function(evt){
updateAttr = setInterval(function(){
attrdiv = document.getElementsByClassName('esri-attribution__sources')[0]
attrdiv.innerHTML = attribution.widget.attributionText + ", 国土地理院ベクトルタイル提供実験"
clearInterval(updateAttr);
}, 2);
});
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
Output
You can jump to the latest bin by adding /latest
to your URL
Keyboard Shortcuts
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + ] | Indents selected lines |
ctrl + [ | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + shift + L | Beautify code in active panel |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Open the share options |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
JS Bin URLs
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |