Crater Lake National Park

NPMap

Digital maps for the National Park Service

Leaflet Base API

As a user of the NPMap library, you are responsible for complying with the terms of service for whichever base API(s) and base map/geocoding/routing services you consume in your map.

The version of Leaflet that NPMap uses is updated frequently, and, for the most part, closely mirrors the Master branch. You can view the full API documentation here: http://leafletjs.com/reference.html.

Pros and Cons

Here is a list of some of the strengths and weaknesses of the leaflet base API. This is an opinionated take based on our own experience working with the library.

Pros:

  • Well-documented, extremely stable, and user-friendly API
  • Lightweight and mobile-friendly
  • Utilizes CSS3 to create beautiful effects and provides fallbacks for older browsers
  • Open source means it is easy to extend the out-of-the-box functionality
  • Availability of a large number of open source plugins
  • Large, extremely active, development community

Cons:

  • Not much built-in functionality, meaning you have to write your own code to integrate geocoding/routing, etc.
  • That's it!

Licensing

Leaflet is available as open source software, so no license is required.

Credentials

No credentials are required.

Dependencies

The leaflet base API depends on the following open source libraries:

  1. CartoDB
  2. Wax

Base Layers

The following default base layers are available when utilizing the leaflet base API:

[{
  type: 'Aerial' // MapBox aerial tiles
},{
  type: 'Blank' // No tiles
},{
  type: 'Hybrid' // MapBox hybrid tiles
},{
  type: 'Streets' // MapBox streets tiles
},{
  type: 'Terrain' // MapBox terrain tiles
}]

These base layers can be added to your map via the NPMap.config.baseLayers config. You can also add other layer types (e.g. ArcGisServerRest, TileStream, etc.) as base layers to your map.

If the baseLayers config is not specified in the NPMap.config object, NPMap will default the base layer to type: 'Streets'.

Examples

Here's a link to a filtered list for the leaflet base API examples in the support documentation examples gallery: http://www.nps.gov/npmap/support/library/examples/?f=leaflet.