Example: Leaflet Map

Demonstrates

Example links

About this example

If you want a map on your site but don’t want to pay for a commercial account or deal with API keys and account security, you can try Leaflet . Leaflet is an open source Javascript library for interactive maps. Used together with OpenStreetMap , you get a lightweight, free, and easy to use mapping solution for your web site.

Moshe F. from the FED multilingual team put together a nice little example illustrating a simple use case of a Leaflet map. The HTML/Javascript code for the map is embedded in the HtmlComponent on the page. Since some browsers (Chrome) do not permit geolocation in an iFrame (HtmlComponent), the page’s onReady() event handler retrieves the user’s geolocation and sends the location as a message to the code in the HTML Component. To add other features, or to customize the look and behavior, see the documentation for Leaflet and OpenStreetMap .

1 Like