Skip to content

Instantly share code, notes, and snippets.

@yauh
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yauh/16790a7a15ef167807f9 to your computer and use it in GitHub Desktop.
Save yauh/16790a7a15ef167807f9 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>My Title</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map {
height: 680px;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = L.map('map').setView(new L.LatLng(51.475318, 7.2325099), 16);
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {
minZoom: 9,
maxZoom: 17,
attribution: osmAttrib
});
map.addLayer(osm);
var walkingPath = {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[51.475318, 7.232512],
[51.475628, 7.233512],
[51.475520, 7.234521],
[51.475328, 7.235512]
]
},
"properties": {
"name": "A name"
}
};
var style = {
color: 'red',
weight: 8,
opacity: 0.7
};
// this does not draw anything
var trail = L.geoJson(walkingPath, {
style: style
}).addTo(map);
var polyline = [
[51.475318, 7.232512],
[51.476228, 7.233512],
[51.475520, 7.235521],
[51.475328, 7.235512]
];
// this draws a line:
// var line = L.polyline(polyline, style).addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment