@nextgis/ngw-leaflet 1.18.11 → 1.18.12

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.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.18.11; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.12; author: NextGIS */
2
2
  import 'leaflet/dist/leaflet.css';
3
3
  import { Icon } from 'leaflet';
4
4
  import { NgwMap } from '@nextgis/ngw-map';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 1.18.11; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 1.18.12; author: NextGIS */
2
2
  var NgwLeaflet = (function () {
3
3
  'use strict';
4
4
 
@@ -22912,45 +22912,45 @@ var NgwLeaflet = (function () {
22912
22912
  return CancelablePromise.resolve(undefined);
22913
22913
  }
22914
22914
  function featureLayerIdentify(options) {
22915
- var geom = options.geom, signal = options.signal, cache = options.cache;
22916
- var geom_ = [];
22917
- if (Array.isArray(geom)) {
22918
- geom_ = geom;
22915
+ var geom = options.geom, signal = options.signal, cache = options.cache, layers = options.layers;
22916
+ var wkt = typeof geom === 'string' ? geom : convertGeomToWKT(geom);
22917
+ if (!wkt) {
22918
+ throw new Error('Not valid geometry format to make intersection');
22919
22919
  }
22920
- else {
22921
- var polygon = geom.type === 'Feature'
22922
- ? geom.geometry
22923
- : geom.type === 'Polygon'
22924
- ? geom
22925
- : false;
22926
- if (polygon) {
22927
- geom_ = polygon.coordinates[0];
22928
- }
22920
+ var data = {
22921
+ geom: wkt,
22922
+ srs: 3857,
22923
+ layers: layers,
22924
+ };
22925
+ return options.connector.post('feature_layer.identify', {
22926
+ data: data,
22927
+ signal: signal,
22928
+ cache: cache,
22929
+ });
22930
+ }
22931
+ function convertGeomToWKT(geom) {
22932
+ var coordinates = getPolygonCoordinates(geom);
22933
+ if (!coordinates)
22934
+ return null;
22935
+ var polygonStr = coordinates.map(function (_a) {
22936
+ var lng = _a[0], lat = _a[1];
22937
+ var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
22938
+ return "".concat(x, " ").concat(y);
22939
+ });
22940
+ return "POLYGON((".concat(polygonStr.join(','), "))");
22941
+ }
22942
+ function getPolygonCoordinates(geom) {
22943
+ var _a;
22944
+ if (Array.isArray(geom)) {
22945
+ return geom;
22929
22946
  }
22930
- if (geom_) {
22931
- // create wkt string
22932
- var polygonStr = [];
22933
- for (var _i = 0, geom_1 = geom_; _i < geom_1.length; _i++) {
22934
- var _a = geom_1[_i], lng = _a[0], lat = _a[1];
22935
- var _b = degrees2meters(lng, lat), x = _b[0], y = _b[1];
22936
- polygonStr.push(x + ' ' + y);
22937
- }
22938
- var wkt = "POLYGON((".concat(polygonStr.join(', '), "))");
22939
- var layers = options.layers;
22940
- var data = {
22941
- geom: wkt,
22942
- srs: 3857,
22943
- layers: layers,
22944
- };
22945
- return options.connector.post('feature_layer.identify', {
22946
- data: data,
22947
- signal: signal,
22948
- cache: cache,
22949
- });
22947
+ if (geom.type === 'Feature') {
22948
+ return (_a = geom.geometry) === null || _a === void 0 ? void 0 : _a.coordinates[0];
22950
22949
  }
22951
- else {
22952
- throw new Error('Not valid geometry format to make intersection');
22950
+ if (geom.type === 'Polygon') {
22951
+ return geom.coordinates[0];
22953
22952
  }
22953
+ return null;
22954
22954
  }
22955
22955
  function sendIdentifyRequest(ev, options) {
22956
22956
  deprecatedMapClick(ev);