1

I need to put a geocoder in a Leaflet page and I'd like to uso Photon (rif. http://photon.komoot.de/).

There is a leaflet plugin here https://github.com/komoot/leaflet.photon but no example is given: is there someone that use it in some projects and can give me a little example?

1 Answer 1

2

Why don't you look on the demo source http://photon.komoot.de (Right click > Show source or Ctrl + u with the keyboard)?

I've done a minimum example below just to try and it works

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Photon, search-as-you-type with OpenStreetMap</title>
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css"/>
    <link rel="stylesheet" href="http://photon.komoot.de/static/leaflet.photon/leaflet.photon.css">
    <link rel="stylesheet" href="http://photon.komoot.de/static/css/app.css">
</head>
<body>
<div class="map" id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet-src.js"></script>
<script src="http://photon.komoot.de/static/leaflet.photon/leaflet.photon.js"></script>
<script src="http://photon.komoot.de/static/js/app.js"></script>
</body>
</html>

For fair use, download each file on your own server and never link directly to those remote files: it's only for the demo purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.