arcgis-parser
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -5,2 +5,3 @@ # Changelog | ||
- Add World thumbnail based on BBox | ||
- Support ESRI Image Service | ||
@@ -7,0 +8,0 @@ - Support ES modules |
37
main.js
'use strict'; | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var globalMercator = require('global-mercator'); | ||
var URL = require('url'); | ||
var slippyTile = _interopDefault(require('slippy-tile')); | ||
/** | ||
* @typedef {Object} Service | ||
* @property {string} type | ||
* @property {string} version | ||
* @property {string} title | ||
*/ | ||
/** | ||
* Parse Service | ||
@@ -153,5 +157,7 @@ * | ||
if (json.minScale && json.maxScale) { | ||
minzoom = mapZoom(json.minScale); | ||
maxzoom = mapZoom(json.maxScale); | ||
minzoom = (json.minScale !== 0) ? mapZoom(json.minScale) : 0; | ||
maxzoom = (json.maxScale !== 0) ? mapZoom(json.maxScale) : 18; | ||
} | ||
minzoom = minzoom || 0; | ||
maxzoom = maxzoom || 18; | ||
return { | ||
@@ -182,3 +188,2 @@ title: title, | ||
const parse$$1 = URL.parse(url); | ||
const isWGS84 = json.spatialReference && json.spatialReference.wkid === 4326; | ||
@@ -199,5 +204,5 @@ // getCapabilities | ||
parse$$1.query = { | ||
bbox: isWGS84 ? '{bbox4326}' : '{bbox3857}', | ||
bboxSR: isWGS84 ? 'EPSG:4326' : 'EPSG:3857', | ||
imageSR: 'EPSG:3857', | ||
bbox: '{bbox4326}', | ||
bboxSR: '4326', | ||
imageSR: '3857', | ||
size: '256,256', | ||
@@ -219,5 +224,5 @@ format: format$$1, | ||
parse$$1.query = { | ||
bbox: isWGS84 ? '{bbox4326}' : '{bbox3857}', | ||
bboxSR: isWGS84 ? 'EPSG:4326' : 'EPSG:3857', | ||
imageSR: 'EPSG:3857', | ||
bbox: '{bbox4326}', | ||
bboxSR: '4326', | ||
imageSR: '3857', | ||
size: '256,256', | ||
@@ -234,3 +239,9 @@ format: format$$1, | ||
var world = null; | ||
if (slippy) world = slippyTile([0, 0, 0], slippy); | ||
if (slippy) { | ||
let bbox = parseLayer(url, json).bbox; | ||
// EPSG:3857 doesn't support latitudes higher than 85 degrees | ||
if (bbox[1] < -85) bbox[1] = -85; | ||
if (bbox[3] > 85) bbox[3] = 85; | ||
world = slippy.replace(/{bbox4326}/, bbox.join(',')); | ||
} | ||
return { | ||
@@ -237,0 +248,0 @@ getCapabilities: getCapabilities, |
{ | ||
"name": "arcgis-parser", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Parser for ArcGIS REST Services to human friendly JSON.", | ||
@@ -16,3 +16,3 @@ "main": "main.js", | ||
"scripts": { | ||
"prepublish": "rollup -c rollup.config.js && echo 'module.exports.default = arcgisParser;' >> main.js", | ||
"pretest": "rollup -c rollup.config.js && echo 'module.exports.default = arcgisParser;' >> main.js", | ||
"test": "node -r @std/esm test.js", | ||
@@ -19,0 +19,0 @@ "posttest": "standard src/**.js" |
@@ -63,5 +63,7 @@ import { metersToLngLat } from 'global-mercator' | ||
if (json.minScale && json.maxScale) { | ||
minzoom = mapZoom(json.minScale) | ||
maxzoom = mapZoom(json.maxScale) | ||
minzoom = (json.minScale !== 0) ? mapZoom(json.minScale) : 0 | ||
maxzoom = (json.maxScale !== 0) ? mapZoom(json.maxScale) : 18 | ||
} | ||
minzoom = minzoom || 0 | ||
maxzoom = maxzoom || 18 | ||
return { | ||
@@ -68,0 +70,0 @@ title: title, |
/** | ||
* @typedef {Object} Service | ||
* @property {string} type | ||
* @property {string} version | ||
* @property {string} title | ||
*/ | ||
/** | ||
* Parse Service | ||
@@ -3,0 +10,0 @@ * |
import * as URL from 'url' | ||
import slippyTile from 'slippy-tile' | ||
import parseLayer from './parse-layer' | ||
import { clean } from './utils' | ||
@@ -14,3 +14,2 @@ | ||
const parse = URL.parse(url) | ||
const isWGS84 = json.spatialReference && json.spatialReference.wkid === 4326 | ||
@@ -31,5 +30,5 @@ // getCapabilities | ||
parse.query = { | ||
bbox: isWGS84 ? '{bbox4326}' : '{bbox3857}', | ||
bboxSR: isWGS84 ? 'EPSG:4326' : 'EPSG:3857', | ||
imageSR: 'EPSG:3857', | ||
bbox: '{bbox4326}', | ||
bboxSR: '4326', | ||
imageSR: '3857', | ||
size: '256,256', | ||
@@ -51,5 +50,5 @@ format: format, | ||
parse.query = { | ||
bbox: isWGS84 ? '{bbox4326}' : '{bbox3857}', | ||
bboxSR: isWGS84 ? 'EPSG:4326' : 'EPSG:3857', | ||
imageSR: 'EPSG:3857', | ||
bbox: '{bbox4326}', | ||
bboxSR: '4326', | ||
imageSR: '3857', | ||
size: '256,256', | ||
@@ -66,3 +65,9 @@ format: format, | ||
var world = null | ||
if (slippy) world = slippyTile([0, 0, 0], slippy) | ||
if (slippy) { | ||
let bbox = parseLayer(url, json).bbox | ||
// EPSG:3857 doesn't support latitudes higher than 85 degrees | ||
if (bbox[1] < -85) bbox[1] = -85 | ||
if (bbox[3] > 85) bbox[3] = 85 | ||
world = slippy.replace(/{bbox4326}/, bbox.join(',')) | ||
} | ||
return { | ||
@@ -69,0 +74,0 @@ getCapabilities: getCapabilities, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18789
552