[CfAll DE] Codeschnipsel Wired

Stefan Kaufmann stefan.kaufmann at uni-ulm.de
Tue Oct 7 12:42:48 UTC 2014


Am 07.10.2014 um 14:30 schrieb Magdalena Noffke:

> ja, an so etwas in der Art hatte ich auch gedacht. Gibt es noch
> irgendein Geojson, dass man über eine API einbinden und anzeigen könnte?

Overpass API!

<https://github.com/kartenkarsten/leaflet-layer-overpass>

regards,
-stk



<!DOCTYPE html>
<html>

<head>
   <meta charset="utf-8" />
   <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>
   <script 
src="https://raw.githubusercontent.com/kartenkarsten/leaflet-layer-overpass/master/OverPassLayer.js"></script>
<script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
   <style>
     html, body, #map { height: 100%; width: 100%; margin: 0; }
   </style>

</head>

<body>
   <div id="map"></div>

   <script type="text/javascript">
     var Tiles = 
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
       attribution: '<a href="http://www.openstreetmap.org" 
target="_blank">Terms & Feedback</a>'
     });

     var latitude = 50.941357, longitude = 6.958307, zoom_level = 15;

     var map = L.map('map').addLayer(Tiles).setView([latitude, 
longitude], zoom_level);

     L.marker([latitude, longitude]).addTo(map)
       .bindPopup("<b>Hello Germany!</b><br />I'm a simple 
map.").openPopup();


     var postbox = new L.OverPassLayer({
         minzoom: 15,
         query: 
"http://overpass-api.de/api/interpreter?data=[out:json];node(BBOX)[amenity=post_box];out;"
         });

     map.addLayer(postbox);


   </script>
</body>
</html>


More information about the cfallde mailing list