Using and Customizing Leaflet

Leaflet is a simple javascript framework for building web-mapping applications. In thier words:

Leaflet is a modern, lightweight open-source JavaScript library for mobile-friendly interactive maps. It is developed by CloudMade to form the core of its next generation JavaScript API. Weighing just about 21kb of gzipped JS code, it still has all the features you will ever need for your web mapping needs, while providing a fast, smooth, pleasant user experience.

It is built from the ground up to work efficiently and smoothly on both desktop and mobile platforms like iOS and Android, utilizing cutting-edge technologies included in HTML5 and CSS3. The focus is on usability, performance, small size, A-grade browser support, flexibility and an easy-to-use API. The OOP-based code of the library is designed to be modular, extensible and very easy to understand.

When you're choosing a javascript framework to build your web-mapping application, you have a myriad of options. Why choose Leaflet? Well this is why I liked it:

  1. It is seriously easy to understand and extend. There isn't a huge amount of out-of-the-box functionality (like there is with OpenLayers, but it is easy to add the functionality you need. It is easy to go and read the source code and follow along with what your application is doing, and this makes it easy for you to make adjustments where you need them.
  2. It works nicely on an Android or iOS device. If that isn't very important to you maybe you should rethink whether you need to put a map online at all. Embrace change! Touchscreens are the future!
  3. The lack of out-of-the-box functionality encourages you to simplify your application, which is the #1 problem with most web-mapping applications that I see. It encourages you to think about what the data is that you're trying to portray, and what the best ways are to do that. Leaflet is not very good for government agencies who think they should make an online map containing 700 layers and no clear direction or focus. But ask yourself: is there really any good reason to make such a map?
  4. My impression is that Leaflet is created by people whose upmost concerns are good design, and greate usability - they are Web Design people. This is in contrast to other javascript frameworks which generally seem to be created by GIS people. Not that there's anything wrong with GIS people, but often what they imagine to be a wonderful system is entirely useless for not-GIS people. Leaflet puts an emphasis on well-designed, simple, usable maps, as opposed to other frameworks which emphasis complex (and often useless) functionality.

I've begun building a framework for our agency to use for building Leaflet maps. It includes some of my own Leaflet customizations and extensions (for example a simple WFS layer capable of working with WFS servers that provide GeoJSON as an output format -- that is to say... Geoserver). It also provides the skeleton of an application that can be customized heavily through some javascript and css (or preferably, less).

You can check out my work on GitHub: https://github.com/azgs/azgs-leaflet, where you can read about how to use it