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
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 LITERSString lph Liter Per Hour
GALLONSString gph Gallons Per Hour
-
staticJNC.DEPTH_UNITString
-
The Depth Unit used on Web API
Properties:
Name Type Default Description METERSString meters Meters
FEETString feet Feet
FATHOMSString fathoms Fathoms
-
staticJNC.DISTANCE_UNITString
-
The distance unit measure used on Web API distance control
Properties:
Name Type Default Description FEETString feet Feet
METERSString meters Meters
FATHOMSString fathoms Fathoms
KILOMETERSString kilometers Kilometers
MILESString miles Miles
NAUTICALString 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:
-
- https://backbonejs.org/#Events Check the documentation in https://backbonejs.org -> Events section
-
staticJNC.GA_ENABLED
-
Google Analytics traking
-
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_OVERLAYString NOOVERLAY Navionics Native Overlay
TERRAINString TERRAIN Terrain Overlay
SATELLITEString SATELLITE Satellite Overlay
-
staticJNC.MAP_MODEString
-
The MAP Modes
Properties:
Name Type Default Description BOATINGString boating Boating
-
staticJNC.MODEString
-
The different mode allowed
Properties:
Name Type Default Description MARINEString marine Marine or Boating
-
staticJNC.NAVIONICS_CHARTSString
-
The MAP Mode
Properties:
Name Type Default Description NAUTICALString nautical NAUTICAL
SONARCHARTString sonar SONARCHART
-
staticJNC.SAFETY_DEPTH_LEVELString
-
The Safety depth level used on Web API
Properties:
Name Type Default Description METERS_20String level_0 FEET_60String level_0 FATHOMS_10String level_0 METERS_10String level_1 FEET_30String level_1 FATHOMS_5String level_1 METERS_5String level_2 FEET_18String level_2 FATHOMS_2String level_2 METERS_2String level_3 FEET_6String level_3 FATHOMS_1String level_3 LEVEL1String level_1 LEVEL2String level_2 LEVEL3String level_3 LEVEL4String level_4 LEVEL0String level_0 -
staticJNC.SAFETY_DEPTH_RANGENumber
-
The Safety depth level max/min values on Web API
Properties:
Name Type Default Description METERSNumber [0,20] FEETNumber [0,60] FATHOMSNumber [0,10] -
staticJNC.SPEED_UNITString
-
The speed unit measure used on Web API
Properties:
Name Type Default Description KMPHString kmph Kilometres per hour
KNOTString knot Nautical knot
MPHString mph Mile per hour
-
staticJNC.TEMPERATURE_UNITString
-
The temperature unit measure used on Web API
Properties:
Name Type Default Description CELSIUSString celsius Celsius
FAHRENHEITString 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 LITERSString liters Liters
GALLONSString gallons Gallons
Methods
-
.getContext(optionalAsset){string}
-
Retrieve the context of application or asset
Name Type Description optionalAssetstring the optional Asset path
Returns:
context of JNC
Example
<html> ... <body data-root="https://pippo.it/"> .... <script> alert( "The url: " + JNC.getContext("img/map/placemark.png")); <!-- output "The url: https://pippo.it/img/map/placemark.png" --> </script> </body> </html> -
.noConflict(){object}
-
Runs JNC.js in noConflict mode, returning the
JNCvariable 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 valuestring 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="https://webapiv2.navionics.com/dist/webapi/webapi.min.css" > <script type="text/javascript" src="https://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("https://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 callbackcallback The callback used for translation
Example
I18n.setLng('en-US',.....); JNC.setTranslationFunction(i18n.t);
Navionics Web API v2