arcgis-parser
Advanced tools
Comparing version 2.0.0 to 2.0.1
# Changelog | ||
## 2.0.0 - 2017-09-29 | ||
## 2.0.0 - 2017-09-30 | ||
- Support ESRI Image Service | ||
- Support ES modules | ||
@@ -6,0 +7,0 @@ |
@@ -1,61 +0,44 @@ | ||
declare function arcgisParser(url: arcgisParser.Options | string): Promise<arcgisParser.Metadata> | ||
declare namespace arcgisParser { | ||
type BBox = [number, number, number, number] | ||
type Protocol = 'http' | 'https' | ||
export type BBox = [number, number, number, number] | ||
export type Protocol = 'http' | 'https' | ||
interface Options { | ||
url?: string | ||
protocol?: Protocol | ||
host?: string | ||
pathname?: string | ||
service?: string | ||
query?: {[key: string]: any} | ||
} | ||
export interface URL { | ||
getCapabilities: string | ||
slippy: string | ||
world: string | ||
host: string | ||
} | ||
interface URL { | ||
getCapabilities: string | ||
slippy: string | ||
world: string | ||
host: string | ||
} | ||
export interface Service { | ||
type: string | ||
version: string | ||
title: string | ||
} | ||
interface Service { | ||
type: string | ||
version: string | ||
title: string | ||
} | ||
export interface Layer { | ||
title: string | ||
identifier: string | ||
author: string | ||
abstract: string | ||
attribution: string | ||
category: string | ||
keywords: string | ||
format: string | ||
formats: string | ||
minzoom: number | ||
maxzoom: number | ||
bbox: BBox | ||
} | ||
interface Layer { | ||
title: string | ||
identifier: string | ||
author: string | ||
abstract: string | ||
category: string | ||
keywords: string | ||
format: string | ||
formats: string | ||
minzoom: number | ||
maxzoom: number | ||
bbox: BBox | ||
} | ||
export interface Metadata { | ||
service: Service | ||
layer: Layer | ||
url: URL | ||
} | ||
interface Metadata { | ||
service: Service | ||
layer: Layer | ||
url: URL | ||
} | ||
/** | ||
* Metadata | ||
*/ | ||
export function metadata(url: Options | string, json: any): Metadata | ||
/** | ||
* Format | ||
*/ | ||
export function format(options: Options): string | ||
/** | ||
* Get | ||
*/ | ||
export function get(url: Options | string): Promise<any> | ||
} | ||
export = arcgisParser | ||
/** | ||
* Parser for ArcGIS REST Services to human friendly JSON. | ||
* | ||
* @param url ArcGIS REST service url | ||
* @param json MapServer or ImageServer JSON | ||
*/ | ||
export default function arcgisParser(url: string, json: object): Metadata |
@@ -8,4 +8,4 @@ import parseService from './src/parse-service' | ||
* | ||
* @param {string} url ArcGIS REST service url | ||
* @param {Object} json MapServer or ImageServer JSON | ||
* @param {string} url ArcGIS REST service url | ||
* @returns {Metadata} Metadata | ||
@@ -12,0 +12,0 @@ * @example |
{ | ||
"name": "arcgis-parser", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Parser for ArcGIS REST Services to human friendly JSON.", | ||
"main": "arcgis-parser.js", | ||
"main": "main.js", | ||
"module": "index.js", | ||
@@ -12,8 +12,8 @@ "jsnext:main": "index.js", | ||
"index.d.ts", | ||
"arcgis-parser.js", | ||
"main.js", | ||
"src" | ||
], | ||
"scripts": { | ||
"pretest": "rollup -c rollup.config.js", | ||
"test": "node -r @std/esm test/**.test.js", | ||
"prepublish": "rollup -c rollup.config.js", | ||
"test": "node -r @std/esm test.js", | ||
"posttest": "standard src/**.js" | ||
@@ -34,5 +34,8 @@ }, | ||
"@std/esm": "*", | ||
"glob": "*", | ||
"load-json-file": "*", | ||
"node-fetch": "*", | ||
"standard": "*", | ||
"tap": "*" | ||
"tape": "*", | ||
"write-json-file": "*" | ||
}, | ||
@@ -39,0 +42,0 @@ "dependencies": { |
@@ -5,2 +5,18 @@ import { metersToLngLat } from 'global-mercator' | ||
/** | ||
* @typedef {Object} Layer | ||
* @property {string} title | ||
* @property {string} identifier | ||
* @property {string} author | ||
* @property {string} abstract | ||
* @property {string} attribution | ||
* @property {string} category | ||
* @property {string} keywords | ||
* @property {string} format | ||
* @property {string} formats | ||
* @property {number} minzoom | ||
* @property {number} maxzoom | ||
* @property {Array<number>} bbox | ||
*/ | ||
/** | ||
* Parse Layer | ||
@@ -20,7 +36,6 @@ * | ||
// Formats | ||
const formats = json.supportedImageFormatTypes | ||
var format | ||
var format = 'jpg' | ||
const formats = json.supportedImageFormatTypes || '' | ||
if (formats.match(/png/i)) format = 'png' | ||
else if (formats.match(/jpg/i)) format = 'jpg' | ||
else format = null | ||
@@ -57,3 +72,4 @@ // BBox | ||
author: documentInfo.Author || null, | ||
abstract: documentInfo.Subject || null, | ||
abstract: json.description || json.serviceDescription || null, | ||
attribution: json.copyrightText || null, | ||
category: documentInfo.Category || null, | ||
@@ -60,0 +76,0 @@ keywords: documentInfo.Keywords || null, |
@@ -23,2 +23,4 @@ import * as URL from 'url' | ||
var slippy = null | ||
// Map Server | ||
if (json.capabilities && json.capabilities.includes('Map')) { | ||
@@ -35,2 +37,3 @@ const formats = json.supportedImageFormatTypes || '' | ||
transparent: 'true', | ||
noData: 0, | ||
f: 'image' | ||
@@ -42,8 +45,29 @@ } | ||
} | ||
// Image Server | ||
if (json.capabilities && json.capabilities.includes('Image')) { | ||
const formats = json.supportedImageFormatTypes || '' | ||
const format = (formats.match(/png/i)) ? 'png' : 'jpg' | ||
parse.query = { | ||
bbox: isWGS84 ? '{bbox4326}' : '{bbox3857}', | ||
bboxSR: isWGS84 ? 'EPSG:4326' : 'EPSG:3857', | ||
imageSR: 'EPSG:3857', | ||
size: '256,256', | ||
format: format, | ||
transparent: 'true', | ||
noData: 0, | ||
f: 'image' | ||
} | ||
parse.path = null | ||
parse.pathname = parse.pathname + '/exportImage' | ||
slippy = clean(URL.format(parse)) | ||
} | ||
var world = null | ||
if (slippy) world = slippyTile([0, 0, 0], slippy) | ||
return { | ||
getCapabilities: getCapabilities, | ||
slippy: slippy, | ||
world: slippyTile([0, 0, 0], slippy), | ||
world: world, | ||
host: parse.host | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18347
527
7