@antv/l7-source
Advanced tools
Comparing version 2.21.0 to 2.21.1
@@ -64,3 +64,4 @@ export type DataType = string | object[] | object; | ||
operation?: IBandsOperation; | ||
extent: [number, number, number, number]; | ||
extent?: [number, number, number, number]; | ||
coordinates?: [[number, number], [number, number], [number, number], [number, number]]; | ||
width: number; | ||
@@ -67,0 +68,0 @@ height: number; |
@@ -172,3 +172,2 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
}; | ||
if (cfg === undefined || typeof cfg.geojsonvtOptions === 'undefined') { | ||
@@ -175,0 +174,0 @@ return defaultOptions; |
import type { IParserData } from '@antv/l7-core'; | ||
import type { RequestParameters } from '@antv/l7-utils'; | ||
interface IImageCfg { | ||
extent: [number, number, number, number]; | ||
export interface IImageCfg { | ||
extent?: [number, number, number, number]; | ||
coordinates?: [[number, number], [number, number], [number, number], [number, number]]; | ||
requestParameters?: Omit<RequestParameters, 'url'>; | ||
} | ||
export default function image(data: string | string[] | HTMLImageElement | ImageBitmap, cfg: IImageCfg): IParserData; | ||
export {}; |
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import { getImage, isImageBitmap } from '@antv/l7-utils'; | ||
import { extentToCoord } from "../utils/util"; | ||
export default function image(data, cfg) { | ||
@@ -7,2 +8,3 @@ // 为 extent 赋默认值 | ||
extent = _cfg$extent === void 0 ? [121.168, 30.2828, 121.384, 30.4219] : _cfg$extent, | ||
coordinates = cfg.coordinates, | ||
_cfg$requestParameter = cfg.requestParameters, | ||
@@ -19,2 +21,3 @@ requestParameters = _cfg$requestParameter === void 0 ? {} : _cfg$requestParameter; | ||
}); | ||
var imageCoord = extentToCoord(coordinates, extent); | ||
var resultData = { | ||
@@ -26,3 +29,3 @@ originData: data, | ||
_id: 0, | ||
coordinates: [[extent[0], extent[1]], [extent[2], extent[3]]] | ||
coordinates: imageCoord | ||
}] | ||
@@ -29,0 +32,0 @@ }; |
import { bandsOperation } from "../utils/bandOperation/bands"; | ||
import { isNumberArray } from "../utils/util"; | ||
import { isNumberArray, extentToCoord } from "../utils/util"; | ||
export default function raster(data, cfg) { | ||
var extent = cfg.extent, | ||
var _cfg$extent = cfg.extent, | ||
extent = _cfg$extent === void 0 ? [121.168, 30.2828, 121.384, 30.4219] : _cfg$extent, | ||
coordinates = cfg.coordinates, | ||
width = cfg.width, | ||
@@ -25,2 +27,3 @@ height = cfg.height, | ||
} | ||
var imageCoord = extentToCoord(coordinates, extent); | ||
var resultData = { | ||
@@ -35,3 +38,3 @@ _id: 1, | ||
max: max, | ||
coordinates: [[extent[0], extent[1]], [extent[2], extent[3]]] | ||
coordinates: imageCoord | ||
}] | ||
@@ -38,0 +41,0 @@ }; |
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
var _excluded = ["extent", "width", "height"]; | ||
var _excluded = ["extent", "coordinates", "width", "height"]; | ||
import { extentToCoord } from "../../utils/util"; | ||
/** | ||
@@ -10,3 +12,5 @@ * @description: 栅格数据解析 | ||
export default function rasterRgb(data, cfg) { | ||
var extent = cfg.extent, | ||
var _cfg$extent = cfg.extent, | ||
extent = _cfg$extent === void 0 ? [121.168, 30.2828, 121.384, 30.4219] : _cfg$extent, | ||
coordinates = cfg.coordinates, | ||
width = cfg.width, | ||
@@ -27,2 +31,3 @@ height = cfg.height, | ||
} | ||
var imageCoord = extentToCoord(coordinates, extent); | ||
var resultData = { | ||
@@ -36,3 +41,3 @@ _id: 1, | ||
}, options), {}, { | ||
coordinates: [[extent[0], extent[1]], [extent[2], extent[3]]] | ||
coordinates: imageCoord | ||
})] | ||
@@ -39,0 +44,0 @@ }; |
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
var _excluded = ["extent", "width", "height"]; | ||
var _excluded = ["extent", "coordinates", "width", "height"]; | ||
import { percentile } from "../../utils/bandOperation/operationSchema"; | ||
import { extentToCoord } from "../../utils/util"; | ||
@@ -13,2 +14,3 @@ /** | ||
var extent = cfg.extent, | ||
coordinates = cfg.coordinates, | ||
width = cfg.width, | ||
@@ -39,2 +41,3 @@ height = cfg.height, | ||
} | ||
var imageCoord = extentToCoord(coordinates, extent); | ||
var resultData = { | ||
@@ -51,3 +54,3 @@ _id: 1, | ||
}, options), {}, { | ||
coordinates: [[extent[0], extent[1]], [extent[2], extent[3]]] | ||
coordinates: imageCoord | ||
})] | ||
@@ -54,0 +57,0 @@ }; |
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
var _excluded = ["extent", "min", "max", "width", "height", "format", "operation"]; | ||
var _excluded = ["extent", "coordinates", "min", "max", "width", "height", "format", "operation"]; | ||
import { bandsOperation } from "../utils/bandOperation/bands"; | ||
import { isNumberArray } from "../utils/util"; | ||
import { isNumberArray, extentToCoord } from "../utils/util"; | ||
export default function rasterRgb(data, cfg) { | ||
var extent = cfg.extent, | ||
coordinates = cfg.coordinates, | ||
min = cfg.min, | ||
@@ -25,2 +26,3 @@ max = cfg.max, | ||
} | ||
var imageCoord = extentToCoord(coordinates, extent); | ||
var resultData = { | ||
@@ -36,3 +38,3 @@ _id: 1, | ||
max: max, | ||
coordinates: [[extent[0], extent[1]], [extent[2], extent[3]]] | ||
coordinates: imageCoord | ||
})] | ||
@@ -39,0 +41,0 @@ }; |
@@ -31,3 +31,2 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
dataArray: hexbinBins.map(function (hex, index) { | ||
var _ref; | ||
if (option.field && method) { | ||
@@ -37,3 +36,3 @@ var columns = Satistics.getColumn(hex, option.field); | ||
} | ||
return _ref = {}, _defineProperty(_ref, option.method, hex[method]), _defineProperty(_ref, "count", hex.length), _defineProperty(_ref, "rawData", hex), _defineProperty(_ref, "coordinates", [hex.x, hex.y]), _defineProperty(_ref, "_id", index), _ref; | ||
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, option.method, hex[method]), "count", hex.length), "rawData", hex), "coordinates", [hex.x, hex.y]), "_id", index); | ||
}), | ||
@@ -40,0 +39,0 @@ radius: pixlSize, |
@@ -17,2 +17,3 @@ import type { Feature, FeatureCollection, Geometries } from '@turf/helpers'; | ||
export declare function geojsonRewind<T extends FeatureCollection | Feature | Geometries>(geojson: T): T; | ||
export declare function extentToCoord(coord: [number, number][] | undefined, extent: [number, number, number, number]): number[][]; | ||
export {}; |
@@ -60,2 +60,7 @@ import { lodashUtil } from '@antv/l7-utils'; | ||
return data; | ||
} | ||
// raster and image layer extentToCoord | ||
export function extentToCoord(coord, extent) { | ||
return coord ? coord : [[extent[0], extent[3]], [extent[2], extent[3]], [extent[2], extent[1]], [extent[0], extent[1]]]; | ||
} |
@@ -26,5 +26,7 @@ var __defProp = Object.defineProperty; | ||
var import_l7_utils = require("@antv/l7-utils"); | ||
var import_util = require("../utils/util"); | ||
function image(data, cfg) { | ||
const { | ||
extent = [121.168, 30.2828, 121.384, 30.4219], | ||
coordinates, | ||
requestParameters = {} | ||
@@ -41,2 +43,3 @@ } = cfg; | ||
}); | ||
const imageCoord = (0, import_util.extentToCoord)(coordinates, extent); | ||
const resultData = { | ||
@@ -49,6 +52,3 @@ originData: data, | ||
_id: 0, | ||
coordinates: [ | ||
[extent[0], extent[1]], | ||
[extent[2], extent[3]] | ||
] | ||
coordinates: imageCoord | ||
} | ||
@@ -55,0 +55,0 @@ ] |
@@ -28,3 +28,12 @@ var __defProp = Object.defineProperty; | ||
function raster(data, cfg) { | ||
const { extent, width, height, min, max, format, operation } = cfg; | ||
const { | ||
extent = [121.168, 30.2828, 121.384, 30.4219], | ||
coordinates, | ||
width, | ||
height, | ||
min, | ||
max, | ||
format, | ||
operation | ||
} = cfg; | ||
let bandData; | ||
@@ -41,2 +50,3 @@ let rasterWidth; | ||
} | ||
const imageCoord = (0, import_util.extentToCoord)(coordinates, extent); | ||
const resultData = { | ||
@@ -52,6 +62,3 @@ _id: 1, | ||
max, | ||
coordinates: [ | ||
[extent[0], extent[1]], | ||
[extent[2], extent[3]] | ||
] | ||
coordinates: imageCoord | ||
} | ||
@@ -58,0 +65,0 @@ ] |
@@ -25,4 +25,5 @@ var __defProp = Object.defineProperty; | ||
module.exports = __toCommonJS(ndi_exports); | ||
var import_util = require("../../utils/util"); | ||
function rasterRgb(data, cfg) { | ||
const { extent, width, height, ...options } = cfg; | ||
const { extent = [121.168, 30.2828, 121.384, 30.4219], coordinates, width, height, ...options } = cfg; | ||
if (data.length < 2) { | ||
@@ -37,2 +38,3 @@ console.warn("RGB解析需要2个波段的数据"); | ||
} | ||
const imageCoord = (0, import_util.extentToCoord)(coordinates, extent); | ||
const resultData = { | ||
@@ -47,6 +49,3 @@ _id: 1, | ||
...options, | ||
coordinates: [ | ||
[extent[0], extent[1]], | ||
[extent[2], extent[3]] | ||
] | ||
coordinates: imageCoord | ||
} | ||
@@ -53,0 +52,0 @@ ] |
@@ -26,4 +26,5 @@ var __defProp = Object.defineProperty; | ||
var import_operationSchema = require("../../utils/bandOperation/operationSchema"); | ||
var import_util = require("../../utils/util"); | ||
function rasterRgb(data, cfg) { | ||
const { extent, width, height, ...options } = cfg; | ||
const { extent, coordinates, width, height, ...options } = cfg; | ||
if (data.length < 3) { | ||
@@ -44,2 +45,3 @@ console.warn("RGB解析需要三个波段的数据"); | ||
} | ||
const imageCoord = (0, import_util.extentToCoord)(coordinates, extent); | ||
const resultData = { | ||
@@ -57,6 +59,3 @@ _id: 1, | ||
...options, | ||
coordinates: [ | ||
[extent[0], extent[1]], | ||
[extent[2], extent[3]] | ||
] | ||
coordinates: imageCoord | ||
} | ||
@@ -63,0 +62,0 @@ ] |
@@ -28,3 +28,3 @@ var __defProp = Object.defineProperty; | ||
function rasterRgb(data, cfg) { | ||
const { extent, min, max, width, height, format, operation, ...rest } = cfg; | ||
const { extent, coordinates, min, max, width, height, format, operation, ...rest } = cfg; | ||
let bandData; | ||
@@ -37,2 +37,3 @@ if (format === void 0 || (0, import_util.isNumberArray)(data)) { | ||
} | ||
const imageCoord = (0, import_util.extentToCoord)(coordinates, extent); | ||
const resultData = { | ||
@@ -49,6 +50,3 @@ _id: 1, | ||
max, | ||
coordinates: [ | ||
[extent[0], extent[1]], | ||
[extent[2], extent[3]] | ||
] | ||
coordinates: imageCoord | ||
} | ||
@@ -55,0 +53,0 @@ ] |
@@ -32,2 +32,3 @@ var __create = Object.create; | ||
__export(util_exports, { | ||
extentToCoord: () => extentToCoord, | ||
geojsonRewind: () => geojsonRewind, | ||
@@ -89,4 +90,13 @@ getColumn: () => getColumn, | ||
} | ||
function extentToCoord(coord, extent) { | ||
return coord ? coord : [ | ||
[extent[0], extent[3]], | ||
[extent[2], extent[3]], | ||
[extent[2], extent[1]], | ||
[extent[0], extent[1]] | ||
]; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
extentToCoord, | ||
geojsonRewind, | ||
@@ -93,0 +103,0 @@ getColumn, |
{ | ||
"name": "@antv/l7-source", | ||
"version": "2.21.0", | ||
"version": "2.21.1", | ||
"description": "", | ||
@@ -28,4 +28,4 @@ "license": "ISC", | ||
"@antv/async-hook": "^2.2.9", | ||
"@antv/l7-core": "2.21.0", | ||
"@antv/l7-utils": "2.21.0", | ||
"@antv/l7-core": "2.21.1", | ||
"@antv/l7-utils": "2.21.1", | ||
"@babel/runtime": "^7.7.7", | ||
@@ -55,3 +55,3 @@ "@mapbox/geojson-rewind": "^0.5.2", | ||
}, | ||
"gitHead": "7fa1b00b5262c98bb4cceef4eaf87a7b10af7e29" | ||
"gitHead": "1e0d2e5920f479f77095a2c5eddda8a8d7ac9e0f" | ||
} |
227567
6126
+ Added@antv/l7-core@2.21.1(transitive)
+ Added@antv/l7-utils@2.21.1(transitive)
- Removed@antv/l7-core@2.21.0(transitive)
- Removed@antv/l7-utils@2.21.0(transitive)
Updated@antv/l7-core@2.21.1
Updated@antv/l7-utils@2.21.1