Skip to content
Commits on Source (6)
mgrs (1.0.0-1~exp2) UNRELEASED; urgency=medium
* Update Vcs-* URLs for Salsa.
-- Bas Couwenberg <sebastic@debian.org> Sat, 31 Mar 2018 12:26:21 +0200
mgrs (1.0.0-1~exp1) experimental; urgency=medium
* New upstream release.
-- Bas Couwenberg <sebastic@debian.org> Wed, 01 Mar 2017 07:52:29 +0100
mgrs (0.0.3-3) unstable; urgency=medium
* Change section of libjs-mgrs to web.
......
......@@ -8,8 +8,8 @@ Build-Depends: debhelper (>= 9),
nodejs,
node-uglify
Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-grass/mgrs.git/
Vcs-Git: https://anonscm.debian.org/git/pkg-grass/mgrs.git
Vcs-Browser: https://salsa.debian.org/debian-gis-team/mgrs/
Vcs-Git: https://salsa.debian.org/debian-gis-team/mgrs.git
Homepage: https://github.com/proj4js/mgrs
Package: libjs-mgrs
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mgrs
Upstream-Contact: MetaCRS Developers <metacrs@lists.osgeo.org>
Source: https://github.com/proj4js/mgrs
......
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.mgrs=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.mgrs = global.mgrs || {})));
}(this, (function (exports) { 'use strict';
/**
* UTM zones are grouped, and assigned to one of a group of 6
......@@ -31,7 +33,11 @@ var I = 73; // I
var O = 79; // O
var V = 86; // V
var Z = 90; // Z
var mgrs = {
forward: forward,
inverse: inverse,
toPoint: toPoint
};
/**
* Conversion of lat/lon to MGRS.
*
......@@ -41,13 +47,13 @@ var Z = 90; // Z
* 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
* @return {string} the MGRS string for the given location and accuracy.
*/
exports.forward = function(ll, accuracy) {
function forward(ll, accuracy) {
accuracy = accuracy || 5; // default accuracy 1m
return encode(LLtoUTM({
lat: ll[1],
lon: ll[0]
}), accuracy);
};
}
/**
* Conversion of MGRS to lat/lon.
......@@ -57,21 +63,21 @@ exports.forward = function(ll, accuracy) {
* (longitude) and top (latitude) values in WGS84, representing the
* bounding box for the provided MGRS reference.
*/
exports.inverse = function(mgrs) {
function inverse(mgrs) {
var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
if (bbox.lat && bbox.lon) {
return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
}
return [bbox.left, bbox.bottom, bbox.right, bbox.top];
};
}
exports.toPoint = function(mgrs) {
function toPoint(mgrs) {
var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
if (bbox.lat && bbox.lon) {
return [bbox.lon, bbox.lat];
}
return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
};
}
/**
* Conversion from degrees to radians.
*
......@@ -742,5 +748,11 @@ function getMinNorthing(zoneLetter) {
}
},{}]},{},[1])(1)
});
exports['default'] = mgrs;
exports.forward = forward;
exports.inverse = inverse;
exports.toPoint = toPoint;
Object.defineProperty(exports, '__esModule', { value: true });
})));
......@@ -30,7 +30,11 @@ var I = 73; // I
var O = 79; // O
var V = 86; // V
var Z = 90; // Z
export default {
forward: forward,
inverse: inverse,
toPoint: toPoint
};
/**
* Conversion of lat/lon to MGRS.
*
......@@ -40,7 +44,7 @@ var Z = 90; // Z
* 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
* @return {string} the MGRS string for the given location and accuracy.
*/
exports.forward = function(ll, accuracy) {
export function forward(ll, accuracy) {
accuracy = accuracy || 5; // default accuracy 1m
return encode(LLtoUTM({
lat: ll[1],
......@@ -56,7 +60,7 @@ exports.forward = function(ll, accuracy) {
* (longitude) and top (latitude) values in WGS84, representing the
* bounding box for the provided MGRS reference.
*/
exports.inverse = function(mgrs) {
export function inverse(mgrs) {
var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
if (bbox.lat && bbox.lon) {
return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
......@@ -64,7 +68,7 @@ exports.inverse = function(mgrs) {
return [bbox.left, bbox.bottom, bbox.right, bbox.top];
};
exports.toPoint = function(mgrs) {
export function toPoint(mgrs) {
var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
if (bbox.lat && bbox.lon) {
return [bbox.lon, bbox.lat];
......
{
"name": "mgrs",
"version": "0.0.2",
"version": "1.0.0",
"description": "Utility for converting between WGS84 lat/lng and MGRS coordinates",
"main": "mgrs.js",
"main": "dist/mgrs.js",
"module": "mgrs.js",
"scripts": {
"test": "./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js",
"build": "mkdir -p dist && browserify mgrs.js -s mgrs | derequire > dist/mgrs.js"
"test": "npm run build && istanbul test _mocha test/test.js",
"build": "mkdir -p dist && rollup -c"
},
"repository": {
"type": "git",
......@@ -22,9 +23,8 @@
"url": "https://github.com/proj4js/mgrs/issues"
},
"devDependencies": {
"browserify": "^8.1.1",
"rollup": "^0.41.4",
"chai": "~1.8.1",
"derequire": "^1.2.0",
"istanbul": "~0.1.46",
"mocha": "~1.15.1"
}
......
export default {
entry: 'mgrs.js',
dest: 'dist/mgrs.js',
format: 'umd',
moduleName: 'mgrs',
exports: 'named'
};
var should = require('chai').should();
var mgrs = require('../mgrs');
var mgrs = require('../dist/mgrs');
describe('First MGRS set', function() {
var mgrsStr = "33UXP04";
var point = mgrs.toPoint(mgrsStr);
......