polarmap

    1.2.1 • Public • Published

    PolarMap.js

    A JavaScript library that can re-project Leaflet maps and map features.

    PolarMap.js is part of the Arctic Connect project, specifically the Arctic Web Map module. We thank CANARIE for the funding support.

    There are two layers to PolarMap.js: the lower-level Leaflet.PolarMap plugin, and the basic PolarMap library. Each has their advantages depending on the situation. The basic PolarMap library has the default loadout of plugins and configuration for Arctic Connect tiles and services. The Leaflet.PolarMap plugin lets the developer pick and choose their integrations, at the trade-off of more code/configuration.

    Requirements

    The Leaflet.PolarMap plugin and PolarMap library both require the following JavaScript libraries to be available:

    Support for other versions of these libraries are not currently known, use at your own risk of bugs or unexpected behaviour.

    Using PolarMap.js

    PolarMap.js has a very similar API to Leaflet, so you should feel right at home. First include the stylesheets:

    <link rel="stylesheet" href="css/leaflet.css" />
    <link rel="stylesheet" href="css/polarmap.css" />
    

    Then require the JavaScript:

    <script src="js/jquery.js"></script>
    <script src="js/leaflet.js"></script>
    <script src="js/proj4.js"></script>
    <script src="js/proj4leaflet.js"></script>
    <script src="js/polarmap-src.js"></script>
    

    And then initialize a map the way you would a Leaflet map:

    <body onload="init()">
    ...
    <script>
      function init() {
        var map = PolarMap('mapContainer');
      }
    </script>
    

    And you should be up and running with PolarMap.js. For a more detailed explanation of the API and customization options, please see the API Documentation.

    Building

    It is recommended to download the latest version of PolarMap.js directly from our site. But you can build your own copy from source if you prefer.

    To generate a distribution copy of PolarMap.js, you will need to set up the build environment. This requires Node.js. Once Node is installed, you can use NPM to set up the dependencies:

    $ npm install -g jake
    $ npm install
    

    And then generate the build products:

    $ jake build
    

    Two copies of PolarMap.js will be generated in the dist directory, one with comments and the other compressed with uglifier-js.

    Examples

    See the examples directory for more information on how to use PolarMap.js with various Leaflet plugins and features.

    Development

    To run a local webserver for testing the app, use the packaged Node http-server:

    $ jake server
    

    It will serve the local directory over HTTP on port 8080.

    Tests

    This library has tests for the lower-level plugin that run using Mocha, Sinon, and Expect.js. They can be run in the browser by opening spec/index.html or on the command line with jake test.

    Compatibility

    Different versions of PolarMap.js are available for different versions of Leaflet.

    Leaflet Version PolarMap.js Version
    0.7.x 1.1.x
    1.0.x 2.0.x

    A version of PolarMap.js for Leaflet 1.0.x is not yet available.

    Code Reuse

    This library contains modified code from the leaflet-hash project. Leaflet-hash is MIT Licensed.

    Support

    PolarMap.js is maintained by James Badger (@openfirmware) and the GeoSensorWeb Lab. If you have issues with the JavaScript library portion, please post an issue on the PolarMap.js issue tracker.

    If you are having issue with the underlying map data, such as map inaccuracies, missing data, or general style comments, then please post an issue on the Web Map issue tracker.

    License

    PolarMap.js is released under the BSD 2-Clause license (same as Leaflet).

    Install

    npm i polarmap

    DownloadsWeekly Downloads

    8

    Version

    1.2.1

    License

    BSD-2-Clause

    Unpacked Size

    1.85 MB

    Total Files

    106

    Last publish

    Collaborators

    • openfirmware