@nextgis/ngw-map 1.18.11 → 1.18.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.esm-browser.js +35 -35
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +1 -1
- package/lib/ngw-map.global.js +36 -36
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +8 -8
package/lib/ngw-map.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.18.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.18.15; author: NextGIS */
|
|
2
2
|
var events = {exports: {}};
|
|
3
3
|
|
|
4
4
|
var R = typeof Reflect === 'object' ? Reflect : null;
|
|
@@ -7988,44 +7988,44 @@ function fetchIdentifyItem(options) {
|
|
|
7988
7988
|
return CancelablePromise.resolve(undefined);
|
|
7989
7989
|
}
|
|
7990
7990
|
function featureLayerIdentify(options) {
|
|
7991
|
-
const { geom, signal, cache } = options;
|
|
7992
|
-
|
|
7991
|
+
const { geom, signal, cache, layers } = options;
|
|
7992
|
+
const wkt = typeof geom === 'string' ? geom : convertGeomToWKT(geom);
|
|
7993
|
+
if (!wkt) {
|
|
7994
|
+
throw new Error('Not valid geometry format to make intersection');
|
|
7995
|
+
}
|
|
7996
|
+
const data = {
|
|
7997
|
+
geom: wkt,
|
|
7998
|
+
srs: 3857,
|
|
7999
|
+
layers,
|
|
8000
|
+
};
|
|
8001
|
+
return options.connector.post('feature_layer.identify', {
|
|
8002
|
+
data,
|
|
8003
|
+
signal,
|
|
8004
|
+
cache,
|
|
8005
|
+
});
|
|
8006
|
+
}
|
|
8007
|
+
function convertGeomToWKT(geom) {
|
|
8008
|
+
const coordinates = getPolygonCoordinates(geom);
|
|
8009
|
+
if (!coordinates)
|
|
8010
|
+
return null;
|
|
8011
|
+
const polygonStr = coordinates.map(([lng, lat]) => {
|
|
8012
|
+
const [x, y] = degrees2meters(lng, lat);
|
|
8013
|
+
return `${x} ${y}`;
|
|
8014
|
+
});
|
|
8015
|
+
return `POLYGON((${polygonStr.join(',')}))`;
|
|
8016
|
+
}
|
|
8017
|
+
function getPolygonCoordinates(geom) {
|
|
8018
|
+
var _a;
|
|
7993
8019
|
if (Array.isArray(geom)) {
|
|
7994
|
-
|
|
8020
|
+
return geom;
|
|
7995
8021
|
}
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
? geom.geometry
|
|
7999
|
-
: geom.type === 'Polygon'
|
|
8000
|
-
? geom
|
|
8001
|
-
: false;
|
|
8002
|
-
if (polygon) {
|
|
8003
|
-
geom_ = polygon.coordinates[0];
|
|
8004
|
-
}
|
|
8005
|
-
}
|
|
8006
|
-
if (geom_) {
|
|
8007
|
-
// create wkt string
|
|
8008
|
-
const polygonStr = [];
|
|
8009
|
-
for (const [lng, lat] of geom_) {
|
|
8010
|
-
const [x, y] = degrees2meters(lng, lat);
|
|
8011
|
-
polygonStr.push(x + ' ' + y);
|
|
8012
|
-
}
|
|
8013
|
-
const wkt = `POLYGON((${polygonStr.join(', ')}))`;
|
|
8014
|
-
const layers = options.layers;
|
|
8015
|
-
const data = {
|
|
8016
|
-
geom: wkt,
|
|
8017
|
-
srs: 3857,
|
|
8018
|
-
layers,
|
|
8019
|
-
};
|
|
8020
|
-
return options.connector.post('feature_layer.identify', {
|
|
8021
|
-
data,
|
|
8022
|
-
signal,
|
|
8023
|
-
cache,
|
|
8024
|
-
});
|
|
8022
|
+
if (geom.type === 'Feature') {
|
|
8023
|
+
return (_a = geom.geometry) === null || _a === void 0 ? void 0 : _a.coordinates[0];
|
|
8025
8024
|
}
|
|
8026
|
-
|
|
8027
|
-
|
|
8025
|
+
if (geom.type === 'Polygon') {
|
|
8026
|
+
return geom.coordinates[0];
|
|
8028
8027
|
}
|
|
8028
|
+
return null;
|
|
8029
8029
|
}
|
|
8030
8030
|
function sendIdentifyRequest(ev, options) {
|
|
8031
8031
|
deprecatedMapClick(ev);
|