• Crater Lake National Park

    NPMap

    Web maps for the National Park Service

Google 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.

NPMap uses version 3 of the Google Maps JavaScript API. You can view the full API documentation here: https://developers.google.com/maps/documentation/javascript/reference.

Pros and Cons

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

Pros:

  • Enterprise support
  • Well-documented, extremely stable, and feature rich API
  • Large and active development community
  • High-resolution (including oblique) imagery
  • Accurate and extensive transportation data
  • Advanced geocoding and routing engines
  • Access to Google Places, Static Maps, Street View, and Earth APIs
  • Access to advanced web services like Directions, Distance Matrix, Elevation, Geocoding, and Time Zone

Cons:

  • The most restrictive Terms of Use of any of the base APIs that NPMap supports: Content coming from Google (geocodes, street view imagery, tiles, etc.) cannot be consumed in a map not built with the Google Maps API
  • Closed source means it is more difficult to extend the out-of-the-box functionality

Licensing

The National Park Service (NPS) has an enterprise license agreement with Google that allows for the usage of the Google Maps API and its associated services on both internal and public-facing NPS websites. If you are not an NPS employee, partner, or contractor, you cannot use the National Park Service’s enterprise license.

The Google Maps API for Business terms require the NPS to use unique tracking codes for external and internal web maps. If your map is embedded on a web page that is publicly-accessible, you should be good to go. If, however, your map is embedded on an internal web page, it may not be whitelisted. If this is the case, you will see an error message when you try to load the web map:

If you run into this problem, contact the NPMap team and we will add your hostname to the list of approved servers. The following hostnames are currently included on the whitelist:

  • inpniscsfern1.nps.doi.net
  • inside.nps.gov
  • insidemaps.nps.gov

Credentials

NPS Employees, Partners, and Contractors:

If you are an NPS employee, partner, or contractor, you do not need to worry about specifying your own Google Maps credentials; NPMap takes care of this for you. If you want to use the Google Maps API outside of the NPMap library, contact the NPMap team for instructions on authorizing your web map.

Everyone Else:

If you are not an NPS employee, partner, or contractor, you must add the credentials property to the NPMap.config object for your web map.

If you have a Google Maps API for Business license, you can specify your “client” and “channel” parameters in the credentials property. The string you specify must start with an ampersand. If it doesn’t, NPMap will not pass your credentials to the Google Maps servers. Here is an example:


NPMap.config = {
  api: 'google',

  credentials: '&client=YourClientId&channel=YourChannelId'

};

If you do not have a Google Maps API for Business license, you still need to let NPMap know you aren’t an NPS employee, partner, or contractor by specifying any arbitrary string in the credentials property:


NPMap.config = {
  api: 'google',

  credentials: 'RandomTextHere'

};

Disclaimer

If you are using NPMap, a link to the NPS disclaimer page will be automatically added to your map, so you don’t need to manually add this.

If you are an NPS employee, partner, or contractor and you are not using the NPMap library to build your map, you must either:

  1. provide a link to the nps.gov maps disclaimer page when embedding a map built with the Google Maps API in your web page; or
  2. display the following disclaimer on your web page:

References to non-U.S. Department of the Interior (DOI) products do not constitute an endorsement by the DOI. By viewing the Google Maps API on this website, the user agrees to these Terms of Service set forth by Google.

Here’s the HTML markup for the disclaimer:

References to non-U.S. Department of the Interior (DOI) products do not constitute an endorsement by the DOI. By viewing the Google Maps API on this website the user agrees to these <a src="https://developers.google.com/maps/terms">Terms of Service</a> set forth by Google.

Dependencies

The google 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 google base API:

[{
  type: 'Aerial' // Google Maps aerial tiles
},{
  type: 'Blank' // No tiles
},{
  type: 'Hybrid' // Google Maps hybrid tiles
},{
  type: 'Streets' // Google Maps streets tiles
},{
  type: 'Terrain' // Google Maps 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 google base API examples in the support documentation examples gallery: http://www.nps.gov/npmap/support/library/examples/?f=google.