@tomtom-org/maps-sdk-plugin-viewport-places 0.5.2 → 0.5.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 +14 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Viewport Places Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Plugin for the [TomTom Maps SDK for JavaScript](https://docs.tomtom.com/maps-sdk-js/introduction/overview) that keeps places in sync with the current map viewport: each search you add gets its own place module, which searches again whenever the map moves.
|
|
4
4
|
|
|
5
5
|
## Docs & examples
|
|
6
6
|
|
|
@@ -9,13 +9,13 @@ Lightweight plugin for the [TomTom Maps SDK for Javascript](https://docs.tomtom.
|
|
|
9
9
|
|
|
10
10
|
## Quickstart
|
|
11
11
|
|
|
12
|
-
Note:
|
|
12
|
+
Note: this plugin declares `@tomtom-org/maps-sdk` as a peer dependency — ensure the SDK is installed in your project.
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
npm install @tomtom-org/maps-sdk maplibre-gl @tomtom-org/maps-sdk-plugin-viewport-places
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
1. Follow the SDK [Project setup](https://docs.tomtom.com/maps-sdk-js/
|
|
18
|
+
1. Follow the SDK [Project setup](https://docs.tomtom.com/maps-sdk-js/introduction/project-setup) or the Map [quickstart](https://docs.tomtom.com/maps-sdk-js/guides/map/quickstart) to create and initialize a `TomTomMap`.
|
|
19
19
|
|
|
20
20
|
2. Import and use the plugin (plugin-specific steps only):
|
|
21
21
|
|
|
@@ -25,11 +25,22 @@ import { ViewportPlaces } from '@tomtom-org/maps-sdk-plugin-viewport-places';
|
|
|
25
25
|
// assume `map` is your initialized TomTomMap instance
|
|
26
26
|
const viewportPlaces = new ViewportPlaces(map);
|
|
27
27
|
|
|
28
|
+
// a text search
|
|
28
29
|
await viewportPlaces.add({
|
|
29
30
|
id: 'restaurants',
|
|
30
31
|
searchOptions: { query: 'restaurant', limit: 40 },
|
|
31
32
|
minZoom: 12,
|
|
32
33
|
});
|
|
34
|
+
|
|
35
|
+
// a POI category search
|
|
36
|
+
await viewportPlaces.addPOICategories({
|
|
37
|
+
id: 'parking',
|
|
38
|
+
categories: ['PARKING_GARAGE', 'CHARGING_LOCATION'],
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// change or drop a place module by its id
|
|
42
|
+
await viewportPlaces.update({ id: 'restaurants', searchOptions: { query: 'pizza' } });
|
|
43
|
+
viewportPlaces.remove('parking');
|
|
33
44
|
```
|
|
34
45
|
|
|
35
46
|
Place modules are rendered bottom-up in the order they are added: the first added module appears at the bottom and later modules are stacked on top.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tomtom-org/maps-sdk-plugin-viewport-places",
|
|
3
3
|
"author": "TomTom International B.V.",
|
|
4
4
|
"license": "See in LICENSE.txt",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Plugin to leverage search to show places on the current viewport that refresh as the map moves",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"typescript": "^6.0.3",
|
|
18
18
|
"vite": "^8.3.2",
|
|
19
19
|
"vitest": "^4.1.11",
|
|
20
|
-
"@tomtom-org/maps-sdk": "1.0.0-rc.
|
|
20
|
+
"@tomtom-org/maps-sdk": "1.0.0-rc.1"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|