mahal_map 2.2.0 → 2.2.3
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/README.md +29 -2
- package/dist/index.d.mts +55 -27
- package/dist/index.d.ts +55 -27
- package/dist/index.js +1 -1
- package/dist/index.mjs +3 -3
- package/dist/mahal_map.sdk.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -341,7 +341,16 @@ MahalMap.create(
|
|
|
341
341
|
| `active` | что нарисовано прямо сейчас (память SDK) |
|
|
342
342
|
| `rendered` | факт со стороны карты: слой есть в стиле и не погашен |
|
|
343
343
|
|
|
344
|
-
`rendered` появилось в Maps3D 0.8.0; у сборок постарше его нет (`undefined`). Расхождение `active !== rendered` означает, что внутренний признак SDK разошёлся с картой — это видно одной проверкой, без чтения минифицированной сборки.
|
|
344
|
+
`rendered` появилось в Maps3D 0.8.0; у сборок постарше его нет (`undefined`). Расхождение `active !== rendered` означает, что внутренний признак SDK разошёлся с картой — это видно одной проверкой, без чтения минифицированной сборки. Сравнивать поля можно только когда `rendered` есть — иначе на старой сборке любой активный слой покажется расхождением:
|
|
345
|
+
|
|
346
|
+
```ts
|
|
347
|
+
const state = map.getLayerState("terrain");
|
|
348
|
+
|
|
349
|
+
// rendered === undefined — Maps3D < 0.8.0, проверка недоступна
|
|
350
|
+
if (state?.rendered !== undefined && state.active !== state.rendered) {
|
|
351
|
+
reportLayerMismatch(state);
|
|
352
|
+
}
|
|
353
|
+
```
|
|
345
354
|
|
|
346
355
|
Слой может быть включён и при этом не нарисован — и это не ошибка:
|
|
347
356
|
|
|
@@ -1436,7 +1445,7 @@ map.addMarker(marker);
|
|
|
1436
1445
|
| Параметр | Тип | Описание |
|
|
1437
1446
|
| ------------- | ------------------ | ----------------------------------------------------------------------- |
|
|
1438
1447
|
| `coordinates` | `[number, number]` | Координаты маркера в формате `[lng, lat]`. |
|
|
1439
|
-
| `draggable` | `boolean` |
|
|
1448
|
+
| `draggable` | `boolean` | Маркер можно перетаскивать на карте (слушайте `dragend` у результата `addMarker()`). |
|
|
1440
1449
|
| `anchor` | `string` | Anchor MapLibre маркера. |
|
|
1441
1450
|
| `color` | `string` | Цвет стандартного SVG маркера или замена `fill` в пользовательском SVG. |
|
|
1442
1451
|
| `svg` | `string` | Полностью пользовательский SVG. |
|
|
@@ -1701,6 +1710,24 @@ const res = await SearchByLocation({
|
|
|
1701
1710
|
| `token` | `string` | да |
|
|
1702
1711
|
| `type` | `string` | нет |
|
|
1703
1712
|
|
|
1713
|
+
Возвращает тело ответа целиком — `IResponse<ISearchResponse[]>`: объекты рядом с точкой
|
|
1714
|
+
(адреса и POI), по возрастанию `distance` в метрах.
|
|
1715
|
+
|
|
1716
|
+
```ts
|
|
1717
|
+
const { data } = await SearchByLocation({ lat: 40.2808, lng: 69.6248, token });
|
|
1718
|
+
|
|
1719
|
+
const house = data.find((item) => item.type.toLowerCase() === "address");
|
|
1720
|
+
if (house && !Array.isArray(house.detailAddress)) {
|
|
1721
|
+
const { city, street_type, street_name, number } = house.detailAddress;
|
|
1722
|
+
// "Хуҷанд", "кӯчаи", "Камоли Хуҷандӣ", "162/1"
|
|
1723
|
+
}
|
|
1724
|
+
```
|
|
1725
|
+
|
|
1726
|
+
- `type` приходит в разном регистре (`"Address"`, `"poi"`) — сравнивайте через `toLowerCase()`.
|
|
1727
|
+
- Город — в `detailAddress.city` (`city_type`: `шаҳр`). Района в ответе обратного геокодинга нет.
|
|
1728
|
+
- Любое поле `detailAddress` может отсутствовать, в том числе `number`.
|
|
1729
|
+
- Пустой `detailAddress` приходит массивом `[]`.
|
|
1730
|
+
|
|
1704
1731
|
### `CheckJSApi(token)`
|
|
1705
1732
|
|
|
1706
1733
|
Проверяет, активна ли подписка JSApi у токена.
|
package/dist/index.d.mts
CHANGED
|
@@ -230,10 +230,13 @@ interface IMaps3DBuildingsController {
|
|
|
230
230
|
}
|
|
231
231
|
interface IMaps3DBuildingClickInfo {
|
|
232
232
|
id: string | number;
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Атрибуты объекта; `props.osm_id` — идентификатор, который не меняется.
|
|
235
|
+
* Необязательно: peerDependency допускает сборки Maps3D от 0.5.0, где поля может не быть.
|
|
236
|
+
*/
|
|
237
|
+
props?: Record<string, unknown>;
|
|
238
|
+
/** Высота здания в метрах. Необязательно по той же причине, что и `props`. */
|
|
239
|
+
height?: number;
|
|
237
240
|
/** Порядковый номер внутри сцены. Живёт до ближайшей пересборки геометрии. */
|
|
238
241
|
index?: number;
|
|
239
242
|
[key: string]: unknown;
|
|
@@ -466,31 +469,52 @@ interface ISearchByLocationParam {
|
|
|
466
469
|
token: string;
|
|
467
470
|
type?: string;
|
|
468
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Тип объекта в ответе геокодера. Регистр у сервиса плавает: обратный геокодинг отдаёт
|
|
474
|
+
* `"Address"`, прямой — `"address"`. Сравнивайте через `type.toLowerCase()`.
|
|
475
|
+
*/
|
|
476
|
+
type SearchResultType = "poi" | "locality" | "address" | "Address" | (string & {});
|
|
477
|
+
/** Адрес объекта. Любое поле может отсутствовать — сервис отдаёт только то, что знает. */
|
|
478
|
+
interface ISearchDetailAddress {
|
|
479
|
+
/** Область: `вилоят`, `Суғд`. */
|
|
480
|
+
subject_type?: string;
|
|
481
|
+
subject_name?: string;
|
|
482
|
+
/** Город: `шаҳр`, `Хуҷанд`. Так город приходит в обратном геокодинге. */
|
|
483
|
+
city_type?: string;
|
|
484
|
+
city?: string;
|
|
485
|
+
/** Район / ноҳия. */
|
|
486
|
+
region_type?: string;
|
|
487
|
+
region?: string;
|
|
488
|
+
/** Населённый пункт — встречается в ответах вместо `city`. */
|
|
489
|
+
settlement_type?: string;
|
|
490
|
+
settlement?: string;
|
|
491
|
+
/** Посёлок / махалля. */
|
|
492
|
+
village_type?: string;
|
|
493
|
+
village?: string;
|
|
494
|
+
/** Улица: `кӯчаи`, `Камоли Хуҷандӣ`. */
|
|
495
|
+
street_type?: string;
|
|
496
|
+
street_name?: string;
|
|
497
|
+
/** Номер дома. У многих POI его нет. */
|
|
498
|
+
number?: string;
|
|
499
|
+
}
|
|
500
|
+
interface ISearchDetailInfo {
|
|
501
|
+
name?: string;
|
|
502
|
+
short_name?: string;
|
|
503
|
+
categories?: string;
|
|
504
|
+
translate_ru?: string;
|
|
505
|
+
description?: string;
|
|
506
|
+
phone?: string;
|
|
507
|
+
website?: string;
|
|
508
|
+
}
|
|
469
509
|
interface ISearchResponse {
|
|
470
510
|
latitude: number;
|
|
471
511
|
longitude: number;
|
|
472
|
-
type:
|
|
512
|
+
type: SearchResultType;
|
|
513
|
+
/** Расстояние от точки запроса в метрах (обратный геокодинг). */
|
|
473
514
|
distance: number | null;
|
|
474
|
-
detailInfo:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
categories?: string;
|
|
478
|
-
translate_ru?: string;
|
|
479
|
-
description?: string;
|
|
480
|
-
} | null;
|
|
481
|
-
detailAddress: {
|
|
482
|
-
subject_type?: string;
|
|
483
|
-
subject_name?: string;
|
|
484
|
-
region_type?: string;
|
|
485
|
-
region?: string;
|
|
486
|
-
settlement_type?: string;
|
|
487
|
-
settlement?: string;
|
|
488
|
-
village_type?: string;
|
|
489
|
-
village?: string;
|
|
490
|
-
street_type?: string;
|
|
491
|
-
street_name?: string;
|
|
492
|
-
number: string;
|
|
493
|
-
} | [];
|
|
515
|
+
detailInfo: ISearchDetailInfo | null;
|
|
516
|
+
/** Пустой массив — адрес неизвестен. */
|
|
517
|
+
detailAddress: ISearchDetailAddress | [];
|
|
494
518
|
}
|
|
495
519
|
interface ICheckJSApiParam {
|
|
496
520
|
token: string;
|
|
@@ -845,7 +869,11 @@ declare function Router(param: number[][], typeData: string, token: string): Pro
|
|
|
845
869
|
|
|
846
870
|
declare function Search(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
|
|
847
871
|
declare function SearchPoi(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
|
|
848
|
-
|
|
872
|
+
/**
|
|
873
|
+
* Обратный геокодинг. В отличие от Search/SearchPoi возвращает тело ответа целиком:
|
|
874
|
+
* `{ success, data: ISearchResponse[], message }` — объекты рядом с точкой, по `distance`.
|
|
875
|
+
*/
|
|
876
|
+
declare function SearchByLocation(params: ISearchByLocationParam): Promise<IResponse<ISearchResponse[]>>;
|
|
849
877
|
declare function CheckJSApi(token: string): Promise<ICheckJSApiResponse>;
|
|
850
878
|
|
|
851
879
|
declare const index$2_CheckJSApi: typeof CheckJSApi;
|
|
@@ -1102,4 +1130,4 @@ declare namespace index {
|
|
|
1102
1130
|
export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
|
|
1103
1131
|
}
|
|
1104
1132
|
|
|
1105
|
-
export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DBuildingsOptions, type IMaps3DClosuresOptions, type IMaps3DDiagnostics, type IMaps3DHoverStyle, type IMaps3DIndoorOptions, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DLayerParams, type IMaps3DLayerState, type IMaps3DMapOptionsInput, type IMaps3DMapOptionsResult, type IMaps3DObjectsLightOptions, type IMaps3DParkingHoverStyle, type IMaps3DParkingInfo, type IMaps3DPlacesOptions, type IMaps3DRoadHit, type IMaps3DSelectionStyle, type IMaps3DTrafficOptions, type IMaps3DTransformRequestOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type MapStyleFamily, type Maps3DBuildingDetail, type Maps3DCtor, type Maps3DLayerId, type Maps3DParkingSubtype, type Maps3DTerrainMode, type Maps3DThemeName, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
|
1133
|
+
export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DBuildingsOptions, type IMaps3DClosuresOptions, type IMaps3DDiagnostics, type IMaps3DHoverStyle, type IMaps3DIndoorOptions, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DLayerParams, type IMaps3DLayerState, type IMaps3DMapOptionsInput, type IMaps3DMapOptionsResult, type IMaps3DObjectsLightOptions, type IMaps3DParkingHoverStyle, type IMaps3DParkingInfo, type IMaps3DPlacesOptions, type IMaps3DRoadHit, type IMaps3DSelectionStyle, type IMaps3DTrafficOptions, type IMaps3DTransformRequestOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchDetailAddress, type ISearchDetailInfo, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type MapStyleFamily, type Maps3DBuildingDetail, type Maps3DCtor, type Maps3DLayerId, type Maps3DParkingSubtype, type Maps3DTerrainMode, type Maps3DThemeName, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type SearchResultType, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -230,10 +230,13 @@ interface IMaps3DBuildingsController {
|
|
|
230
230
|
}
|
|
231
231
|
interface IMaps3DBuildingClickInfo {
|
|
232
232
|
id: string | number;
|
|
233
|
-
/**
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Атрибуты объекта; `props.osm_id` — идентификатор, который не меняется.
|
|
235
|
+
* Необязательно: peerDependency допускает сборки Maps3D от 0.5.0, где поля может не быть.
|
|
236
|
+
*/
|
|
237
|
+
props?: Record<string, unknown>;
|
|
238
|
+
/** Высота здания в метрах. Необязательно по той же причине, что и `props`. */
|
|
239
|
+
height?: number;
|
|
237
240
|
/** Порядковый номер внутри сцены. Живёт до ближайшей пересборки геометрии. */
|
|
238
241
|
index?: number;
|
|
239
242
|
[key: string]: unknown;
|
|
@@ -466,31 +469,52 @@ interface ISearchByLocationParam {
|
|
|
466
469
|
token: string;
|
|
467
470
|
type?: string;
|
|
468
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Тип объекта в ответе геокодера. Регистр у сервиса плавает: обратный геокодинг отдаёт
|
|
474
|
+
* `"Address"`, прямой — `"address"`. Сравнивайте через `type.toLowerCase()`.
|
|
475
|
+
*/
|
|
476
|
+
type SearchResultType = "poi" | "locality" | "address" | "Address" | (string & {});
|
|
477
|
+
/** Адрес объекта. Любое поле может отсутствовать — сервис отдаёт только то, что знает. */
|
|
478
|
+
interface ISearchDetailAddress {
|
|
479
|
+
/** Область: `вилоят`, `Суғд`. */
|
|
480
|
+
subject_type?: string;
|
|
481
|
+
subject_name?: string;
|
|
482
|
+
/** Город: `шаҳр`, `Хуҷанд`. Так город приходит в обратном геокодинге. */
|
|
483
|
+
city_type?: string;
|
|
484
|
+
city?: string;
|
|
485
|
+
/** Район / ноҳия. */
|
|
486
|
+
region_type?: string;
|
|
487
|
+
region?: string;
|
|
488
|
+
/** Населённый пункт — встречается в ответах вместо `city`. */
|
|
489
|
+
settlement_type?: string;
|
|
490
|
+
settlement?: string;
|
|
491
|
+
/** Посёлок / махалля. */
|
|
492
|
+
village_type?: string;
|
|
493
|
+
village?: string;
|
|
494
|
+
/** Улица: `кӯчаи`, `Камоли Хуҷандӣ`. */
|
|
495
|
+
street_type?: string;
|
|
496
|
+
street_name?: string;
|
|
497
|
+
/** Номер дома. У многих POI его нет. */
|
|
498
|
+
number?: string;
|
|
499
|
+
}
|
|
500
|
+
interface ISearchDetailInfo {
|
|
501
|
+
name?: string;
|
|
502
|
+
short_name?: string;
|
|
503
|
+
categories?: string;
|
|
504
|
+
translate_ru?: string;
|
|
505
|
+
description?: string;
|
|
506
|
+
phone?: string;
|
|
507
|
+
website?: string;
|
|
508
|
+
}
|
|
469
509
|
interface ISearchResponse {
|
|
470
510
|
latitude: number;
|
|
471
511
|
longitude: number;
|
|
472
|
-
type:
|
|
512
|
+
type: SearchResultType;
|
|
513
|
+
/** Расстояние от точки запроса в метрах (обратный геокодинг). */
|
|
473
514
|
distance: number | null;
|
|
474
|
-
detailInfo:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
categories?: string;
|
|
478
|
-
translate_ru?: string;
|
|
479
|
-
description?: string;
|
|
480
|
-
} | null;
|
|
481
|
-
detailAddress: {
|
|
482
|
-
subject_type?: string;
|
|
483
|
-
subject_name?: string;
|
|
484
|
-
region_type?: string;
|
|
485
|
-
region?: string;
|
|
486
|
-
settlement_type?: string;
|
|
487
|
-
settlement?: string;
|
|
488
|
-
village_type?: string;
|
|
489
|
-
village?: string;
|
|
490
|
-
street_type?: string;
|
|
491
|
-
street_name?: string;
|
|
492
|
-
number: string;
|
|
493
|
-
} | [];
|
|
515
|
+
detailInfo: ISearchDetailInfo | null;
|
|
516
|
+
/** Пустой массив — адрес неизвестен. */
|
|
517
|
+
detailAddress: ISearchDetailAddress | [];
|
|
494
518
|
}
|
|
495
519
|
interface ICheckJSApiParam {
|
|
496
520
|
token: string;
|
|
@@ -845,7 +869,11 @@ declare function Router(param: number[][], typeData: string, token: string): Pro
|
|
|
845
869
|
|
|
846
870
|
declare function Search(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
|
|
847
871
|
declare function SearchPoi(param: string, token: string, additionalParam?: IAdditionalParamType): Promise<ISearchResponse[]>;
|
|
848
|
-
|
|
872
|
+
/**
|
|
873
|
+
* Обратный геокодинг. В отличие от Search/SearchPoi возвращает тело ответа целиком:
|
|
874
|
+
* `{ success, data: ISearchResponse[], message }` — объекты рядом с точкой, по `distance`.
|
|
875
|
+
*/
|
|
876
|
+
declare function SearchByLocation(params: ISearchByLocationParam): Promise<IResponse<ISearchResponse[]>>;
|
|
849
877
|
declare function CheckJSApi(token: string): Promise<ICheckJSApiResponse>;
|
|
850
878
|
|
|
851
879
|
declare const index$2_CheckJSApi: typeof CheckJSApi;
|
|
@@ -1102,4 +1130,4 @@ declare namespace index {
|
|
|
1102
1130
|
export { index_checkCoordinates as checkCoordinates, index_debounce as debounce, index_geojsonPolyline as geojsonPolyline, index_geometryPolyline as geometryPolyline, index_trimValue as trimValue };
|
|
1103
1131
|
}
|
|
1104
1132
|
|
|
1105
|
-
export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DBuildingsOptions, type IMaps3DClosuresOptions, type IMaps3DDiagnostics, type IMaps3DHoverStyle, type IMaps3DIndoorOptions, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DLayerParams, type IMaps3DLayerState, type IMaps3DMapOptionsInput, type IMaps3DMapOptionsResult, type IMaps3DObjectsLightOptions, type IMaps3DParkingHoverStyle, type IMaps3DParkingInfo, type IMaps3DPlacesOptions, type IMaps3DRoadHit, type IMaps3DSelectionStyle, type IMaps3DTrafficOptions, type IMaps3DTransformRequestOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type MapStyleFamily, type Maps3DBuildingDetail, type Maps3DCtor, type Maps3DLayerId, type Maps3DParkingSubtype, type Maps3DTerrainMode, type Maps3DThemeName, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|
|
1133
|
+
export { CheckJSApi, type IAdditionalParamType, type ICheckJSApiParam, type ICheckJSApiResponse, type IMahalMapOptions, type IMapMarker, type IMaps3DBuildingClickInfo, type IMaps3DBuildingsController, type IMaps3DBuildingsOptions, type IMaps3DClosuresOptions, type IMaps3DDiagnostics, type IMaps3DHoverStyle, type IMaps3DIndoorOptions, type IMaps3DLayer, type IMaps3DLayerOptions, type IMaps3DLayerParams, type IMaps3DLayerState, type IMaps3DMapOptionsInput, type IMaps3DMapOptionsResult, type IMaps3DObjectsLightOptions, type IMaps3DParkingHoverStyle, type IMaps3DParkingInfo, type IMaps3DPlacesOptions, type IMaps3DRoadHit, type IMaps3DSelectionStyle, type IMaps3DTrafficOptions, type IMaps3DTransformRequestOptions, type IResponse, type IRoute, type ISearchByLocationParam, type ISearchDetailAddress, type ISearchDetailInfo, type ISearchParam, type ISearchResponse, MahalMap, MahalMapDefaultMarker, type MahalMapDefaultMarkerProps, type MapEngine, type MapLanguage, type MapStyleFamily, type Maps3DBuildingDetail, type Maps3DCtor, type Maps3DLayerId, type Maps3DParkingSubtype, type Maps3DTerrainMode, type Maps3DThemeName, type Maps3DTransformRequest, type MeasureIcons, type MeasureLabels, type MeasureMode, type MeasurePoint, type MeasureShape, type MeasureState, type MeasureStyleOptions, MeasureTool, type MeasureToolOptions, Router, Search, SearchByLocation, SearchPoi, type SearchResultType, type Theme, index$2 as keyUtils, index$1 as measureUtils, index as utils };
|