@maptiler/geocoding-control 0.0.32 → 0.0.37
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 +10 -6
- package/dist/leaflet.js +2076 -687
- package/dist/leaflet.umd.cjs +22 -1
- package/dist/lib/LeafletGeocodingControl.d.ts +6 -2
- package/dist/lib/MaplibreglGeocodingControl.d.ts +10 -3
- package/dist/lib/leafletMapController.d.ts +1 -1
- package/dist/lib/maplibreglMapController.d.ts +7 -0
- package/dist/lib/types.d.ts +23 -3
- package/dist/main.d.ts +1 -1
- package/dist/maplibregl.js +2093 -672
- package/dist/maplibregl.umd.cjs +22 -1
- package/dist/style.css +1 -1
- package/package.json +7 -4
- package/src/lib/GeocodingControl.svelte +74 -20
- package/src/lib/LeafletGeocodingControl.ts +23 -4
- package/src/lib/MaplibreglGeocodingControl.ts +32 -8
- package/src/lib/ReverseGeocodingIcon.svelte +12 -0
- package/src/lib/leafletMapController.ts +119 -20
- package/src/lib/maplibreglMapController.ts +291 -0
- package/src/lib/types.ts +26 -3
- package/dist/lib/maplibreMapController.d.ts +0 -4
- package/src/lib/BullseyeIcon.svelte +0 -12
- package/src/lib/maplibreMapController.ts +0 -149
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ import maplibregl from "maplibre-gl";
|
|
|
19
19
|
import { GeocodingControl } from "@maptiler/geocoding-control/maplibre";
|
|
20
20
|
import "@maptiler/geocoding-control/dist/style.css";
|
|
21
21
|
|
|
22
|
-
const API_KEY = "
|
|
22
|
+
const API_KEY = "YOUR_MAPTILER_API_KEY_HERE";
|
|
23
23
|
|
|
24
24
|
const map = new maplibregl.Map({
|
|
25
25
|
container: "map", // id of HTML container element
|
|
@@ -99,14 +99,18 @@ Options:
|
|
|
99
99
|
- `clearOnBlur`: `boolean` - If true, the geocoder control will clear its value when the input blurs. Default `false`.
|
|
100
100
|
- `filter`: `(feature: Feature) => boolean` - A function which accepts a Feature in the Carmen GeoJSON format to filter out results from the Geocoding API response before they are included in the suggestions list. Return true to keep the item, false otherwise.
|
|
101
101
|
- `class`: `string` - Class of the root element.
|
|
102
|
-
- `enableReverse`: `boolean |
|
|
102
|
+
- `enableReverse`: `boolean | "always""` - Set to `true` to enable reverse geocoding button with title. Set to `"always"` to reverse geocoding be always active. Default `false`.
|
|
103
|
+
- `reverseButtonTitle`: `string` - Reverse toggle button title. Default `"toggle reverse geocoding"`.
|
|
104
|
+
- `clearButtonTitle`: `string` - Clear button title. Default `"clear"`.
|
|
105
|
+
- `showFullGeometry`: `boolean` - Set to `true` to show full feature geometry of the chosen result. Otherwise only marker will be shown. Default `true`.
|
|
106
|
+
- `fullGeometryStyle`: `{ fill: Pick<FillLayerSpecification, "layout" | "paint" | "filter">; line: Pick<LineLayerSpecification, "layout" | "paint" | "filter">; } | (L.PathOptions | L.StyleFunction)` - style of the full feature geometry. See Mapplibre GL JS or Leaflet documentation.
|
|
103
107
|
|
|
104
108
|
Methods:
|
|
105
109
|
|
|
106
110
|
- `setQuery(value: string, submit = true): void` - set the query and optionally submit it
|
|
107
111
|
- `focus(): void` - focus the query input box
|
|
108
112
|
- `blur(): void` - blur the query input box
|
|
109
|
-
- `setReverseMode(value: boolean): void` - set reverse mode
|
|
113
|
+
- `setReverseMode(value: boolean | "always"): void` - set reverse mode
|
|
110
114
|
|
|
111
115
|
Events:
|
|
112
116
|
|
|
@@ -128,12 +132,12 @@ Component API matches API described above and options are exposed as component p
|
|
|
128
132
|
<script lang="ts">
|
|
129
133
|
import GeocodingControl from "@maptiler/geocoding-control/src/lib/GeocodingControl.svelte";
|
|
130
134
|
import GeocodingControl from "@maptiler/geocoding-control/src/lib/GeocodingControl.svelte";
|
|
131
|
-
import {
|
|
135
|
+
import { createMaplibreglMapController } from "@maptiler/geocoding-control/src/lib/maplibreglMapController";
|
|
132
136
|
import type { MapController } from "@maptiler/geocoding-control/src/lib/types";
|
|
133
137
|
import maplibregl from "maplibre-gl";
|
|
134
138
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
135
139
|
|
|
136
|
-
const apiKey = "
|
|
140
|
+
const apiKey = "YOUR_MAPTILER_API_KEY_HERE";
|
|
137
141
|
|
|
138
142
|
let mapController: MapController;
|
|
139
143
|
|
|
@@ -146,7 +150,7 @@ Component API matches API described above and options are exposed as component p
|
|
|
146
150
|
container,
|
|
147
151
|
});
|
|
148
152
|
|
|
149
|
-
const mapController =
|
|
153
|
+
const mapController = createMaplibreglMapController(map, maplibregl);
|
|
150
154
|
}
|
|
151
155
|
</script>
|
|
152
156
|
|