Skip to content

Instantly share code, notes, and snippets.

@frogcat
Last active April 20, 2019 02:11
Show Gist options
  • Save frogcat/0d12822c04d40857579e to your computer and use it in GitHub Desktop.
Save frogcat/0d12822c04d40857579e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
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="https://pbs.twimg.com/profile_images/623512768377794560/BJC9anEC.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