Skip to content

Instantly share code, notes, and snippets.

@ix4
Forked from frogcat/13113.geojson
Last active April 20, 2019 02:12
Show Gist options
  • Select an option

  • Save ix4/2e4013a8c223ae888ba7c485ec332e27 to your computer and use it in GitHub Desktop.

Select an option

Save ix4/2e4013a8c223ae888ba7c485ec332e27 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" />
<title>trump</title>
<link rel="stylesheet" href="//cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="//cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<style>
body {
width: 100%;
height: 100%;
overflow: hidden;
}
#map {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
}
.trump {
fill: url(#texture);
fill-opacity: 0.8;
stroke: white;
stroke-width: 2px;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<pattern id="texture" x="0" y="0" width="64" height="64" patternUnits="userSpaceOnUse"
patternContentUnits="userSpaceOnUse">
<image xlink:href="http://i66.tinypic.com/2nqckg9.jpg" x="0" y="0" width="64"
height="64" />
</pattern>
</defs>
</svg>
<div id="map"></div>
<script>
var map = L.map("map", {
minZoom : 12,
maxZoom : 20,
zoom : 16,
center : [ 35.658342, 139.701462 ]
});
L.tileLayer('http://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg', {
"attribution" : "<a href='http://maps.gsi.go.jp/development/'>地理院タイル・オルソ画像(国土地理院)</a>"
}).addTo(map);
var x = new XMLHttpRequest();
x.onreadystatechange = function() {
if (x.readyState == 4) {
var layer = L.geoJson(JSON.parse(x.responseText), {
className : 'trump'
});
layer.addTo(map);
map.fitBounds(layer.getBounds());
}
};
x.open("get", "13113.geojson", true);
x.send();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment