Namespace: JNC

JNC

JNC is an acronym for jNavionicsChart, the javascript namespace for Navionics WebAPI. The WebApi v2 allows you to easily add Navionics maps to any website. Below you'll find a complete working example. Create a new file, copy the content below, and open it in a browser:

Example

    <html lang="en">
      <head>
          ...
          <link href=".../webapi.min.css" rel="stylesheet">
          <script src=" .../webapi.min.js"></script>
          ...
      </head>
      <body>
         <div class="navionics_map_div" style="width: 100%; height:100%;"></div>
         <script>
          var webapi = new JNC.Views.BoatingNavionicsMap({ ...  });
          </script>
      </body>
    </html>

Namespaces

Google
Leaflet
ProductCatalog
Views

Members

staticJNC.BUILD_TIME

When the library was built

staticJNC.CONSUMPTION_UNITString

The consumption unit measure used on Web API

Properties:
Name Type Default Description
LITERS String lph

Liter Per Hour

GALLONS String gph

Gallons Per Hour

staticJNC.DEPTH_UNITString

The Depth Unit used on Web API

Properties:
Name Type Default Description
METERS String meters

Meters

FEET String feet

Feet

FATHOMS String fathoms

Fathoms

staticJNC.DISTANCE_UNITString

The distance unit measure used on Web API distance control

Properties:
Name Type Default Description
FEET String feet

Feet

METERS String meters

Meters

FATHOMS String fathoms

Fathoms

KILOMETERS String kilometers

Kilometers

MILES String miles

Miles

NAUTICAL String nautical

Nautical Miles

staticJNC.Events

Events is one Overloading of BackboneJS/Events system. It allow to listen and send message on the Master Event BUS of this library

See:

staticJNC.i18nfunction

The service used for translating every part of the library

staticJNC.MAP_LAYERSString

All Possible layers of map

Properties:
Name Type Default Description
NO_OVERLAY String NOOVERLAY

Navionics Native Overlay

TERRAIN String TERRAIN

Terrain Overlay

SATELLITE String SATELLITE

Satellite Overlay

staticJNC.MAP_MODEString

The MAP Modes

Properties:
Name Type Default Description
BOATING String boating

Boating

SKI String ski

Ski

staticJNC.MODEString

The different mode allowed

Properties:
Name Type Default Description
MARINE String marine

Marine or Boating

SKI String ski

Ski

HIKE_BIKE String hike_bike

HIKE & BIKE

FLY String fly

Fly

staticJNC.NAVIONICS_CHARTSString

The MAP Mode

Properties:
Name Type Default Description
NAUTICAL String nautical

NAUTICAL

SONARCHART String sonar

SONARCHART

SKI String ski

SKI

staticJNC.SAFETY_DEPTH_LEVELString

The Safety depth level used on Web API

Properties:
Name Type Default Description
METERS_20 String level_0
FEET_60 String level_0
FATHOMS_10 String level_0
METERS_10 String level_1
FEET_30 String level_1
FATHOMS_5 String level_1
METERS_5 String level_2
FEET_18 String level_2
FATHOMS_2 String level_2
METERS_2 String level_3
FEET_6 String level_3
FATHOMS_1 String level_3
LEVEL1 String level_1
LEVEL2 String level_2
LEVEL3 String level_3
LEVEL4 String level_4
LEVEL0 String level_0

staticJNC.SAFETY_DEPTH_RANGENumber

The Safety depth level max/min values on Web API

Properties:
Name Type Default Description
METERS Number [0,20]
FEET Number [0,60]
FATHOMS Number [0,10]

staticJNC.SPEED_UNITString

The speed unit measure used on Web API

Properties:
Name Type Default Description
KMPH String kmph

Kilometres per hour

KNOT String knot

Nautical knot

MPH String mph

Mile per hour

staticJNC.TEMPERATURE_UNITString

The temperature unit measure used on Web API

Properties:
Name Type Default Description
CELSIUS String celsius

Celsius

FAHRENHEIT String fahrenheit

Fahrenheit

staticJNC.VERSION

Current version of the library.

staticJNC.VOLUME_UNITString

The volume unit measure used on Web API

Properties:
Name Type Default Description
LITERS String liters

Liters

GALLONS String gallons

Gallons

Methods

.getContext(optionalAsset){string}

Retrieve the context of application or asset

Name Type Description
optionalAsset string

the optional Asset path

Returns:
context of JNC
Example
      <html>
        ...
        <body data-root="http://pippo.it/">
        ....
           <script>
              alert( "The url: " + JNC.getContext("img/map/placemark.png"));
              <!-- output "The url: http://pippo.it/img/map/placemark.png" -->
           </script>
        </body>
      </html>

.noConflict(){object}

Runs JNC.js in noConflict mode, returning the JNC variable to its previous owner. Returns a reference to this JNC object.

Returns:
JNC

.setContent()

Deprecated
  • since version jNavionicsChart 2.1.5-alpha

    .setContext(value)

    Set the context of application or assets

    Name Type Description
    value string

    base url of webapi

    Example
        <!DOCTYPE html>
        <html lang="en">
        <head>
            <meta charset="utf-8">
            <meta content="width=device-width, initial-scale=1.0" name="viewport">
            <meta content="authenticity_token" name="csrf-param" />
            <title>Navionics Web API v2</title>
            <link rel="stylesheet" href="http://webapiv2.navionics.com/dist/webapi/webapi.min.css" >
            <script type="text/javascript" src="http://webapiv2.navionics.com/dist/webapi/webapi.min.no-dep.js"></script>
            <style type="text/css">
                html, body, .test_map_div {
                    margin: 0;
                    width: 100%;
                    height: 100%;
                }
            </style>
        </head>
        <body>
           <div class="test_map_div" ></div>
            <script>
                JNC.setContext("http://webapiv2.navionics.com/dist/webapi/images");
                var webapi = new JNC.Views.BoatingNavionicsMap({
                    tagId: '.test_map_div',
                    center: [  12.0, 46.0 ],
                    navKey: '*****'
                });
            </script>
        </body>
        </html>

    .setTranslationFunction(callback)

    Inject I18n Function

    Name Type Description
    callback callback

    The callback used for translation

    Example
        I18n.setLng('en-US',.....);
        JNC.setTranslationFunction(i18n.t);