@maptiler/geocoding-control 1.3.3 → 1.4.1
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 +3 -4
- package/icons/airport.svg +6 -0
- package/icons/animal_shelter.svg +4 -0
- package/icons/art_gallery.svg +4 -0
- package/icons/atm.svg +5 -1
- package/icons/barrier.svg +4 -0
- package/icons/baseball.svg +4 -0
- package/icons/basketball.svg +4 -0
- package/icons/bbq.svg +4 -1
- package/icons/beach.svg +4 -0
- package/icons/beer.svg +4 -1
- package/icons/bench.svg +4 -1
- package/icons/bicycle.svg +4 -1
- package/icons/bicycle_parking.svg +5 -1
- package/icons/bicycle_rental.svg +5 -1
- package/icons/billiards.svg +4 -0
- package/icons/board.svg +4 -1
- package/icons/bollard.svg +4 -0
- package/icons/bowling.svg +4 -1
- package/icons/building.svg +4 -0
- package/icons/bulldozer.svg +4 -0
- package/icons/bus_guided.svg +4 -0
- package/icons/bus_trolley.svg +4 -0
- package/icons/butcher.svg +4 -1
- package/icons/camper_trailer.svg +4 -0
- package/icons/campfire.svg +4 -0
- package/icons/caution.svg +4 -0
- package/icons/cemetery.svg +3 -11
- package/icons/charging_station.svg +4 -1
- package/icons/christian.svg +5 -0
- package/icons/circle-dot.svg +4 -0
- package/icons/circle-stroke.svg +4 -0
- package/icons/circle.svg +4 -0
- package/icons/city.svg +4 -0
- package/icons/communications_tower.svg +4 -1
- package/icons/confectionery.svg +4 -1
- package/icons/construction.svg +4 -0
- package/icons/cricket.svg +4 -0
- package/icons/cross.svg +4 -1
- package/icons/cycle_barrier.svg +4 -0
- package/icons/dam.svg +4 -0
- package/icons/danger.svg +4 -0
- package/icons/diamond.svg +4 -0
- package/icons/diamond_stroked.svg +4 -0
- package/icons/dot.svg +4 -0
- package/icons/drinking_water.svg +4 -1
- package/icons/emergency_phone.svg +4 -1
- package/icons/entrance.svg +4 -0
- package/icons/farm.svg +3 -8
- package/icons/fence.svg +4 -0
- package/icons/florist.svg +4 -1
- package/icons/furniture.svg +4 -1
- package/icons/gaming.svg +4 -0
- package/icons/garden.svg +4 -0
- package/icons/garden_centre.svg +4 -1
- package/icons/gate.svg +4 -1
- package/icons/globe.svg +4 -0
- package/icons/golf_green.svg +4 -0
- package/icons/gondola.svg +4 -0
- package/icons/guidepost.svg +4 -1
- package/icons/hardware.svg +3 -3
- package/icons/heart.svg +4 -0
- package/icons/heliport.svg +4 -0
- package/icons/highway_rest_area.svg +4 -0
- package/icons/home.svg +4 -0
- package/icons/hot_spring.svg +4 -1
- package/icons/hut.svg +4 -0
- package/icons/industry.svg +4 -0
- package/icons/karaoke.svg +4 -0
- package/icons/lift_gate.svg +4 -0
- package/icons/light_rail.svg +4 -0
- package/icons/lighthouse.svg +4 -1
- package/icons/marker.svg +4 -0
- package/icons/marker_stroked.svg +4 -0
- package/icons/monorail.svg +4 -0
- package/icons/motorcycle.svg +4 -1
- package/icons/motorcycle_parking.svg +4 -1
- package/icons/motorcycle_rental.svg +4 -0
- package/icons/motorcycle_repair.svg +4 -0
- package/icons/natural.svg +4 -0
- package/icons/noodle.svg +4 -0
- package/icons/obelisk.svg +4 -1
- package/icons/observation_tower.svg +4 -1
- package/icons/oneway.svg +4 -0
- package/icons/optician.svg +4 -1
- package/icons/park.svg +4 -1
- package/icons/parking_paid.svg +4 -0
- package/icons/pin.svg +4 -0
- package/icons/pipe.svg +4 -0
- package/icons/pizza.svg +4 -0
- package/icons/place_of_worship.svg +4 -1
- package/icons/playground.svg +3 -3
- package/icons/racetrack.svg +4 -0
- package/icons/radiation.svg +4 -0
- package/icons/railway.svg +4 -0
- package/icons/ranger_station.svg +4 -0
- package/icons/recycling.svg +4 -1
- package/icons/road_accident.svg +4 -0
- package/icons/roadblock.svg +4 -0
- package/icons/rocket.svg +4 -0
- package/icons/school_bus.svg +4 -0
- package/icons/sculpture.svg +4 -0
- package/icons/seafood.svg +4 -1
- package/icons/shelter.svg +4 -1
- package/icons/shoes.svg +4 -1
- package/icons/sikh.svg +4 -0
- package/icons/snow.svg +4 -0
- package/icons/soccer.svg +4 -1
- package/icons/spring.svg +4 -1
- package/icons/square.svg +4 -0
- package/icons/square_stroked.svg +4 -0
- package/icons/star.svg +4 -0
- package/icons/star_stroked.svg +4 -0
- package/icons/statue.svg +4 -1
- package/icons/subway.svg +4 -0
- package/icons/sushi.svg +4 -0
- package/icons/swimming.svg +5 -0
- package/icons/swimming_pool.svg +8 -0
- package/icons/tako.svg +4 -0
- package/icons/taxi.svg +4 -1
- package/icons/teahouse.svg +4 -0
- package/icons/terminal.svg +4 -1
- package/icons/theme_park.svg +4 -0
- package/icons/town.svg +4 -0
- package/icons/town_hall.svg +4 -1
- package/icons/townhall.svg +4 -1
- package/icons/tram_stop.svg +4 -0
- package/icons/transit.svg +4 -0
- package/icons/triangle.svg +4 -0
- package/icons/triangle_stroked.svg +4 -0
- package/icons/truck.svg +4 -0
- package/icons/tunnel.svg +4 -0
- package/icons/veterinary.svg +4 -1
- package/icons/viewpoint.svg +4 -1
- package/icons/village.svg +4 -0
- package/icons/volleyball.svg +4 -0
- package/icons/warehouse.svg +4 -0
- package/icons/water.svg +3 -5
- package/icons/water_park.svg +6 -1
- package/icons/water_tower.svg +4 -1
- package/icons/watermill.svg +4 -0
- package/icons/wetland.svg +4 -0
- package/icons/wine.svg +4 -0
- package/leaflet-controller.d.ts +2 -2
- package/leaflet-controller.js +1427 -9922
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -9
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +2708 -11166
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -9
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +2 -2
- package/maplibregl-controller.js +1268 -9849
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -9
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.js +2550 -11094
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -9
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +2558 -11102
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -9
- package/maptilersdk.umd.js.map +1 -1
- package/mask.d.ts +1 -1
- package/openlayers-controller.js +1191 -9762
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -9
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +2689 -11223
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -9
- package/openlayers.umd.js.map +1 -1
- package/package.json +26 -24
- package/react.js +996 -955
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte +6 -5
- package/svelte/GeocodingControl.svelte +68 -12
- package/svelte/GeocodingControl.svelte.d.ts +4 -2
- package/svelte/geoUtils.js +7 -1
- package/svelte/leaflet-controller.d.ts +2 -2
- package/svelte/leaflet-controller.js +48 -2
- package/svelte/maplibregl-controller.d.ts +2 -2
- package/svelte/maplibregl-controller.js +5 -2
- package/svelte/mask.d.ts +1 -1
- package/svelte/mask.js +32 -29
- package/svelte/openlayers-controller.js +13 -14
- package/svelte/types.d.ts +15 -9
- package/types.d.ts +15 -9
- package/vanilla.js +1016 -975
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
- package/icons/beach_resort.svg +0 -1
- package/icons/drinking-water.svg +0 -1
- package/icons/emergency-phone.svg +0 -1
- package/icons/rental_bicycle.svg +0 -1
- package/icons/rental_car.svg +0 -1
- /package/icons/{camp_site.svg → campsite.svg} +0 -0
- /package/icons/{toll_booth.svg → toll.svg} +0 -0
package/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-ltkwvy.svelte-ltkwvy{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content}li.svelte-ltkwvy.svelte-ltkwvy:first-child{padding-top:10px}li.svelte-ltkwvy.svelte-ltkwvy:last-child{padding-bottom:10px}li.selected.svelte-ltkwvy.svelte-ltkwvy{background-color:#f3f6ff}li.selected.svelte-ltkwvy.svelte-ltkwvy{animation:svelte-ltkwvy-backAndForth 5s linear infinite}li.selected.svelte-ltkwvy .primary.svelte-ltkwvy{color:#2b8bfb}li.svelte-ltkwvy>img.svelte-ltkwvy{align-self:center;justify-self:center;opacity:.75}.texts.svelte-ltkwvy.svelte-ltkwvy{padding:0 17px 0 0}.texts.svelte-ltkwvy>.svelte-ltkwvy{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-ltkwvy.svelte-ltkwvy{font-weight:600}.secondary.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7;padding-left:4px}.line2.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7}@keyframes svelte-ltkwvy-backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-gzo3ar.svelte-gzo3ar{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-gzo3ar.svelte-gzo3ar{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-gzo3ar.svelte-gzo3ar{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-gzo3ar path.svelte-gzo3ar,.leaflet-map-pane svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-gzo3ar path.svelte-gzo3ar{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}circle.svelte-1aq105l{stroke-width:1.875;fill:none}path.svelte-1aq105l{stroke-width:1.875;stroke-linecap:round}svg.svelte-1aq105l{display:block;stroke:var(--color-icon-button)}form.svelte-
|
|
1
|
+
svg.svelte-d2loi5{display:block;fill:#e15042}li.svelte-ltkwvy.svelte-ltkwvy{text-align:left;cursor:default;display:grid;grid-template-columns:40px 1fr;color:var(--color-text);padding:8px 0;font-size:14px;line-height:18px;min-width:fit-content}li.svelte-ltkwvy.svelte-ltkwvy:first-child{padding-top:10px}li.svelte-ltkwvy.svelte-ltkwvy:last-child{padding-bottom:10px}li.selected.svelte-ltkwvy.svelte-ltkwvy{background-color:#f3f6ff}li.selected.svelte-ltkwvy.svelte-ltkwvy{animation:svelte-ltkwvy-backAndForth 5s linear infinite}li.selected.svelte-ltkwvy .primary.svelte-ltkwvy{color:#2b8bfb}li.svelte-ltkwvy>img.svelte-ltkwvy{align-self:center;justify-self:center;opacity:.75}.texts.svelte-ltkwvy.svelte-ltkwvy{padding:0 17px 0 0}.texts.svelte-ltkwvy>.svelte-ltkwvy{white-space:nowrap;display:block;min-width:fit-content}.primary.svelte-ltkwvy.svelte-ltkwvy{font-weight:600}.secondary.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7;padding-left:4px}.line2.svelte-ltkwvy.svelte-ltkwvy{color:#aeb6c7}@keyframes svelte-ltkwvy-backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 270px))}55%{transform:translate(calc(-100% + 270px))}90%{transform:translate(0)}to{transform:translate(0)}}div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-gzo3ar.svelte-gzo3ar{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-gzo3ar.svelte-gzo3ar{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-gzo3ar.svelte-gzo3ar{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-gzo3ar path.svelte-gzo3ar,.leaflet-map-pane svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-gzo3ar path.svelte-gzo3ar{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-gzo3ar path.svelte-gzo3ar{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}circle.svelte-1aq105l{stroke-width:1.875;fill:none}path.svelte-1aq105l{stroke-width:1.875;stroke-linecap:round}svg.svelte-1aq105l{display:block;stroke:var(--color-icon-button)}form.svelte-qnu791.svelte-qnu791{font-family:Open Sans,Ubuntu,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;z-index:10;border-radius:4px;transition:max-width .25s;box-shadow:0 2px 5px #33335926;--color-text:#444952;--color-icon-button:#444952}form.svelte-qnu791.svelte-qnu791,form.svelte-qnu791 .svelte-qnu791,form.svelte-qnu791 .svelte-qnu791:after,form.svelte-qnu791 .svelte-qnu791:before{box-sizing:border-box}form.can-collapse.svelte-qnu791.svelte-qnu791{max-width:29px}form.can-collapse.svelte-qnu791 input.svelte-qnu791::placeholder{transition:opacity .25s;opacity:0}form.svelte-qnu791.svelte-qnu791,form.svelte-qnu791.svelte-qnu791:focus-within,form.svelte-qnu791.svelte-qnu791:hover{width:270px;max-width:270px}form.svelte-qnu791 input.svelte-qnu791::placeholder,form.svelte-qnu791:focus-within input.svelte-qnu791::placeholder,form.svelte-qnu791:hover input.svelte-qnu791::placeholder{opacity:1}input.svelte-qnu791.svelte-qnu791{font:inherit;font-size:14px;flex-grow:1;min-height:29px;background-color:transparent;color:#444952;white-space:nowrap;overflow:hidden;border:0;margin:0;padding:0}input.svelte-qnu791.svelte-qnu791:focus{color:#444952;outline:0;outline:none;box-shadow:none}ul.svelte-qnu791.svelte-qnu791,div.error.svelte-qnu791.svelte-qnu791,div.no-results.svelte-qnu791.svelte-qnu791{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);overflow:hidden}ul.svelte-qnu791.svelte-qnu791{font-size:14px;line-height:16px;box-shadow:0 5px 10px #33335926}div.error.svelte-qnu791.svelte-qnu791,div.no-results.svelte-qnu791.svelte-qnu791{font:inherit;line-height:18px;font-size:12px;display:flex;gap:16px}div.error.svelte-qnu791.svelte-qnu791{padding:16px;font-weight:600;color:#e25041;background-color:#fbeae8}div.error.svelte-qnu791 div.svelte-qnu791{flex-grow:1}div.error.svelte-qnu791 svg{flex-shrink:0;width:20px;height:20px}div.error.svelte-qnu791 button.svelte-qnu791{flex-shrink:0}div.error.svelte-qnu791 button.svelte-qnu791>svg{width:13px;fill:#e25041}div.error.svelte-qnu791 button.svelte-qnu791:hover svg,div.error.svelte-qnu791 button.svelte-qnu791:active svg{fill:#444952}div.no-results.svelte-qnu791.svelte-qnu791{padding:14px 24px 14px 16px;font-weight:400;color:#6b7c93;box-shadow:0 5px 10px #33335926}div.no-results.svelte-qnu791 svg{margin-top:4px;flex-shrink:0;width:20px;height:20px;width:30px;height:30px}.maplibregl-ctrl-bottom-left ul.svelte-qnu791.svelte-qnu791,.maplibregl-ctrl-bottom-right ul.svelte-qnu791.svelte-qnu791{top:auto;bottom:100%}button.svelte-qnu791.svelte-qnu791{padding:0;margin:0;border:0;background-color:transparent;height:auto;width:auto}button.svelte-qnu791.svelte-qnu791:hover{background-color:transparent}button.svelte-qnu791:hover svg,button.svelte-qnu791:active svg{fill:#2b8bfb}.input-group.svelte-qnu791.svelte-qnu791{display:flex;align-items:stretch;gap:7px;padding-inline:8px;border-radius:4px;overflow:hidden}.input-group.svelte-qnu791.svelte-qnu791:focus-within{outline:#2b8bfb solid 2px}.search-button.svelte-qnu791.svelte-qnu791{flex-shrink:0}.maplibregl-ctrl-geocoder:not(.maptiler-ctrl) .search-button svg{width:12px!important;transform:translate(.5px)}.clear-button-container.svelte-qnu791.svelte-qnu791{display:flex;display:none;position:relative;align-items:stretch}.clear-button-container.displayable.svelte-qnu791.svelte-qnu791{display:flex;flex-shrink:0}.maplibregl-ctrl-geocoder{position:relative;z-index:3}.maptiler-ctrl:not(:empty){box-shadow:none}.maptiler-ctrl .input-group.svelte-qnu791.svelte-qnu791{padding-inline:8px;border:white solid 2px}.maptiler-ctrl .input-group.svelte-qnu791.svelte-qnu791:focus-within{border:#2b8bfb solid 2px;outline:0;outline:none}.maptiler-ctrl form.can-collapse.svelte-qnu791.svelte-qnu791{max-width:33px}.maptiler-ctrl form.svelte-qnu791.svelte-qnu791,.maptiler-ctrl form.svelte-qnu791.svelte-qnu791:focus-within,.maptiler-ctrl form.svelte-qnu791.svelte-qnu791:hover{width:270px;max-width:270px}
|
|
@@ -20,9 +20,10 @@ $: {
|
|
|
20
20
|
: undefined;
|
|
21
21
|
} while (index > -1 && (!imageUrl || missingIconsCache.has(imageUrl)));
|
|
22
22
|
}
|
|
23
|
-
$: placeType =
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
$: placeType =
|
|
24
|
+
feature.properties?.categories?.join(", ") ??
|
|
25
|
+
feature.properties?.place_type_name?.[0] ??
|
|
26
|
+
feature.place_type[0];
|
|
26
27
|
function handleImgError() {
|
|
27
28
|
if (imageUrl) {
|
|
28
29
|
missingIconsCache.add(imageUrl);
|
|
@@ -37,7 +38,7 @@ function handleImgError() {
|
|
|
37
38
|
<img src={imageUrl} alt={category} on:error={() => handleImgError()} />
|
|
38
39
|
{:else if feature.address}
|
|
39
40
|
<img src={iconsBaseUrl + "housenumber.svg"} alt={placeType} />
|
|
40
|
-
{:else if feature.
|
|
41
|
+
{:else if feature.id.startsWith("road.")}
|
|
41
42
|
<img src={iconsBaseUrl + "road.svg"} alt={placeType} />
|
|
42
43
|
{:else if feature.id.startsWith("address.")}
|
|
43
44
|
<img src={iconsBaseUrl + "street.svg"} alt={placeType} />
|
|
@@ -57,7 +58,7 @@ function handleImgError() {
|
|
|
57
58
|
{isReverse ? feature.place_name : feature.place_name.replace(/,.*/, "")}
|
|
58
59
|
</span>
|
|
59
60
|
|
|
60
|
-
{#if showPlaceType === "always" || (showPlaceType && !feature.address && feature.
|
|
61
|
+
{#if showPlaceType === "always" || (showPlaceType && !feature.address && !feature.id.startsWith("road.") && !feature.id.startsWith("address.") && !feature.id.startsWith("postal_code.") && (!feature.id.startsWith("poi.") || !imageUrl) && !isReverse)}
|
|
61
62
|
<span class="secondary">
|
|
62
63
|
{placeType}
|
|
63
64
|
</span>
|
|
@@ -9,6 +9,31 @@ import { default as SearchIcon } from "./SearchIcon.svelte";
|
|
|
9
9
|
import { unwrapBbox, wrapNum } from "./geoUtils";
|
|
10
10
|
import { getProximity } from "./proximity";
|
|
11
11
|
import { convert } from "geo-coordinates-parser";
|
|
12
|
+
export const ZOOM_DEFAULTS = {
|
|
13
|
+
continental_marine: 4,
|
|
14
|
+
country: 4,
|
|
15
|
+
major_landform: 8,
|
|
16
|
+
region: 5,
|
|
17
|
+
subregion: 6,
|
|
18
|
+
county: 7,
|
|
19
|
+
joint_municipality: 8,
|
|
20
|
+
joint_submunicipality: 9,
|
|
21
|
+
municipality: 10,
|
|
22
|
+
municipal_district: 11,
|
|
23
|
+
locality: 12,
|
|
24
|
+
neighbourhood: 13,
|
|
25
|
+
place: 14,
|
|
26
|
+
postal_code: 14,
|
|
27
|
+
road: 16,
|
|
28
|
+
poi: 17,
|
|
29
|
+
address: 18,
|
|
30
|
+
"poi.peak": 15,
|
|
31
|
+
"poi.shop": 18,
|
|
32
|
+
"poi.cafe": 18,
|
|
33
|
+
"poi.restaurant": 18,
|
|
34
|
+
"poi.aerodrome": 13,
|
|
35
|
+
// TODO add many more
|
|
36
|
+
};
|
|
12
37
|
let className = undefined;
|
|
13
38
|
export { className as class };
|
|
14
39
|
export let apiKey;
|
|
@@ -43,12 +68,12 @@ export let flyToSelected = false;
|
|
|
43
68
|
export let markerOnSelected = true;
|
|
44
69
|
export let types = undefined;
|
|
45
70
|
export let excludeTypes = false;
|
|
46
|
-
export let zoom =
|
|
47
|
-
export let maxZoom =
|
|
71
|
+
export let zoom = ZOOM_DEFAULTS;
|
|
72
|
+
export let maxZoom = undefined;
|
|
48
73
|
export let apiUrl = "https://api.maptiler.com/geocoding";
|
|
49
74
|
export let fetchParameters = {};
|
|
50
75
|
export let iconsBaseUrl = "https://cdn.maptiler.com/maptiler-geocoding-control/v" +
|
|
51
|
-
"1.
|
|
76
|
+
"1.4.1" +
|
|
52
77
|
"/icons/";
|
|
53
78
|
export let adjustUrlQuery = () => { };
|
|
54
79
|
export function focus() {
|
|
@@ -109,12 +134,10 @@ $: {
|
|
|
109
134
|
if (mapController && picked && picked.id !== prevIdToFly && flyTo) {
|
|
110
135
|
if (!picked.bbox ||
|
|
111
136
|
(picked.bbox[0] === picked.bbox[2] && picked.bbox[1] === picked.bbox[3])) {
|
|
112
|
-
mapController.flyTo(picked.center,
|
|
113
|
-
? maxZoom
|
|
114
|
-
: zoom);
|
|
137
|
+
mapController.flyTo(picked.center, computeZoom(picked));
|
|
115
138
|
}
|
|
116
139
|
else {
|
|
117
|
-
mapController.fitBounds(unwrapBbox(picked.bbox), 50,
|
|
140
|
+
mapController.fitBounds(unwrapBbox(picked.bbox), 50, computeZoom(picked));
|
|
118
141
|
}
|
|
119
142
|
listFeatures = undefined;
|
|
120
143
|
markedFeatures = undefined;
|
|
@@ -123,9 +146,7 @@ $: {
|
|
|
123
146
|
prevIdToFly = picked?.id;
|
|
124
147
|
}
|
|
125
148
|
$: if (mapController && selected && flyTo && flyToSelected) {
|
|
126
|
-
mapController.flyTo(selected.center,
|
|
127
|
-
? maxZoom
|
|
128
|
-
: zoom);
|
|
149
|
+
mapController.flyTo(selected.center, computeZoom(selected));
|
|
129
150
|
}
|
|
130
151
|
// if markerOnSelected was dynamically changed to false
|
|
131
152
|
$: if (!markerOnSelected) {
|
|
@@ -384,7 +405,16 @@ function zoomToResults() {
|
|
|
384
405
|
}
|
|
385
406
|
const bbox = [180, 90, -180, -90];
|
|
386
407
|
const fuzzyOnly = !markedFeatures.some((feature) => !feature.matching_text);
|
|
408
|
+
let allZoom;
|
|
387
409
|
for (const feature of markedFeatures) {
|
|
410
|
+
const featZoom = computeZoom(feature);
|
|
411
|
+
allZoom =
|
|
412
|
+
maxZoom ??
|
|
413
|
+
(allZoom === undefined
|
|
414
|
+
? featZoom
|
|
415
|
+
: featZoom === undefined
|
|
416
|
+
? allZoom
|
|
417
|
+
: Math.max(allZoom, featZoom));
|
|
388
418
|
if (fuzzyOnly || !feature.matching_text) {
|
|
389
419
|
for (const i of [0, 1, 2, 3]) {
|
|
390
420
|
bbox[i] = Math[i < 2 ? "min" : "max"](bbox[i], feature.bbox?.[i] ?? feature.center[i % 2]);
|
|
@@ -393,13 +423,32 @@ function zoomToResults() {
|
|
|
393
423
|
}
|
|
394
424
|
if (mapController && markedFeatures.length > 0) {
|
|
395
425
|
if (picked && bbox[0] === bbox[2] && bbox[1] === bbox[3]) {
|
|
396
|
-
mapController.flyTo(picked.center,
|
|
426
|
+
mapController.flyTo(picked.center, computeZoom(picked));
|
|
397
427
|
}
|
|
398
428
|
else {
|
|
399
|
-
mapController.fitBounds(unwrapBbox(bbox), 50,
|
|
429
|
+
mapController.fitBounds(unwrapBbox(bbox), 50, allZoom);
|
|
400
430
|
}
|
|
401
431
|
}
|
|
402
432
|
}
|
|
433
|
+
function computeZoom(feature) {
|
|
434
|
+
if (!feature.bbox ||
|
|
435
|
+
(feature.bbox[0] !== feature.bbox[2] &&
|
|
436
|
+
feature.bbox[1] !== feature.bbox[3])) {
|
|
437
|
+
return undefined;
|
|
438
|
+
}
|
|
439
|
+
if (typeof zoom === "number") {
|
|
440
|
+
return feature.id.startsWith("poi.") || feature.id.startsWith("address.")
|
|
441
|
+
? maxZoom
|
|
442
|
+
: zoom;
|
|
443
|
+
}
|
|
444
|
+
const index = feature.id.replace(/\..*/, "");
|
|
445
|
+
return ((Array.isArray(feature.properties?.categories)
|
|
446
|
+
? feature.properties.categories.reduce((a, category) => {
|
|
447
|
+
const b = zoom[index + "." + category];
|
|
448
|
+
return a === undefined ? b : b === undefined ? a : Math.max(a, b);
|
|
449
|
+
}, undefined)
|
|
450
|
+
: undefined) ?? zoom[index]);
|
|
451
|
+
}
|
|
403
452
|
function handleReverse(coordinates) {
|
|
404
453
|
reverseActive = enableReverse === "always";
|
|
405
454
|
listFeatures = undefined;
|
|
@@ -572,10 +621,17 @@ form, form *, form *:after, form *:before {
|
|
|
572
621
|
form.can-collapse {
|
|
573
622
|
max-width: 29px;
|
|
574
623
|
}
|
|
624
|
+
form.can-collapse input::placeholder {
|
|
625
|
+
transition: opacity 0.25s;
|
|
626
|
+
opacity: 0;
|
|
627
|
+
}
|
|
575
628
|
form, form:focus-within, form:hover {
|
|
576
629
|
width: 270px;
|
|
577
630
|
max-width: 270px;
|
|
578
631
|
}
|
|
632
|
+
form input::placeholder, form:focus-within input::placeholder, form:hover input::placeholder {
|
|
633
|
+
opacity: 1;
|
|
634
|
+
}
|
|
579
635
|
|
|
580
636
|
input {
|
|
581
637
|
font: inherit;
|
|
@@ -2,6 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import type { BBox, Feature, FeatureCollection, MapController, ProximityRule } from "./types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
+
ZOOM_DEFAULTS?: Record<string, number>;
|
|
5
6
|
class?: string | undefined;
|
|
6
7
|
apiKey: string;
|
|
7
8
|
bbox?: BBox | undefined;
|
|
@@ -33,8 +34,8 @@ declare const __propDef: {
|
|
|
33
34
|
markerOnSelected?: boolean;
|
|
34
35
|
types?: string[] | undefined;
|
|
35
36
|
excludeTypes?: boolean;
|
|
36
|
-
zoom?: number
|
|
37
|
-
maxZoom?: number;
|
|
37
|
+
zoom?: number | Record<string, number>;
|
|
38
|
+
maxZoom?: number | undefined;
|
|
38
39
|
apiUrl?: string;
|
|
39
40
|
fetchParameters?: RequestInit;
|
|
40
41
|
iconsBaseUrl?: string;
|
|
@@ -70,6 +71,7 @@ export type GeocodingControlProps = typeof __propDef.props;
|
|
|
70
71
|
export type GeocodingControlEvents = typeof __propDef.events;
|
|
71
72
|
export type GeocodingControlSlots = typeof __propDef.slots;
|
|
72
73
|
export default class GeocodingControl extends SvelteComponent<GeocodingControlProps, GeocodingControlEvents, GeocodingControlSlots> {
|
|
74
|
+
get ZOOM_DEFAULTS(): Record<string, number>;
|
|
73
75
|
get focus(): () => void;
|
|
74
76
|
get blur(): () => void;
|
|
75
77
|
get setQuery(): (value: string, submit?: boolean, reverse?: boolean) => void;
|
package/svelte/geoUtils.js
CHANGED
|
@@ -6,7 +6,13 @@ export function wrapNum(x, range, includeMax) {
|
|
|
6
6
|
export function unwrapBbox(bbox0) {
|
|
7
7
|
const bbox = [...bbox0];
|
|
8
8
|
if (bbox[2] < bbox[0]) {
|
|
9
|
-
bbox[2]
|
|
9
|
+
if (Math.abs((bbox[0] + bbox[2] + 360) / 2) >
|
|
10
|
+
Math.abs((bbox[0] - 360 + bbox[2]) / 2)) {
|
|
11
|
+
bbox[0] -= 360;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
bbox[2] += 360;
|
|
15
|
+
}
|
|
10
16
|
}
|
|
11
17
|
return bbox;
|
|
12
18
|
}
|
|
@@ -2,8 +2,8 @@ import * as L from "leaflet";
|
|
|
2
2
|
import type { BBox, Feature, MapEvent, Position } from "./types";
|
|
3
3
|
export declare function createLeafletMapController(map: L.Map, marker?: boolean | L.MarkerOptions, showResultMarkers?: boolean | L.MarkerOptions, flyToOptions?: L.ZoomPanOptions, flyToBounds?: L.FitBoundsOptions, fullGeometryStyle?: L.PathOptions | L.StyleFunction): {
|
|
4
4
|
setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
|
|
5
|
-
flyTo(center: Position, zoom
|
|
6
|
-
fitBounds(bbox: BBox, padding: number, maxZoom
|
|
5
|
+
flyTo(center: Position, zoom?: number): void;
|
|
6
|
+
fitBounds(bbox: BBox, padding: number, maxZoom?: number): void;
|
|
7
7
|
indicateReverse(reverse: boolean): void;
|
|
8
8
|
setReverseMarker(coordinates?: Position): void;
|
|
9
9
|
setMarkers(markedFeatures: Feature[] | undefined, picked: Feature | undefined): void;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import bbox from "@turf/bbox";
|
|
2
|
+
import clone from "@turf/clone";
|
|
1
3
|
import { feature, featureCollection } from "@turf/helpers";
|
|
2
4
|
import union from "@turf/union";
|
|
3
5
|
import * as L from "leaflet";
|
|
6
|
+
import { unwrapBbox } from "./geoUtils";
|
|
4
7
|
import MarkerIcon from "./MarkerIcon.svelte";
|
|
5
8
|
import { setMask } from "./mask";
|
|
6
9
|
export function createLeafletMapController(map, marker = true, showResultMarkers = true, flyToOptions = {}, flyToBounds = {}, fullGeometryStyle = (feature) => {
|
|
@@ -65,7 +68,12 @@ export function createLeafletMapController(map, marker = true, showResultMarkers
|
|
|
65
68
|
map.flyToBounds([
|
|
66
69
|
[bbox[1], bbox[0]],
|
|
67
70
|
[bbox[3], bbox[2]],
|
|
68
|
-
], {
|
|
71
|
+
], {
|
|
72
|
+
padding: [padding, padding],
|
|
73
|
+
duration: 2,
|
|
74
|
+
...(maxZoom ? { maxZoom } : {}),
|
|
75
|
+
...flyToBounds,
|
|
76
|
+
});
|
|
69
77
|
},
|
|
70
78
|
indicateReverse(reverse) {
|
|
71
79
|
map.getContainer().style.cursor = reverse ? "crosshair" : "";
|
|
@@ -138,7 +146,24 @@ export function createLeafletMapController(map, marker = true, showResultMarkers
|
|
|
138
146
|
}
|
|
139
147
|
else if (picked.geometry.type === "Polygon" ||
|
|
140
148
|
picked.geometry.type === "MultiPolygon") {
|
|
141
|
-
setMask(picked,
|
|
149
|
+
setMask(picked, (fc) => {
|
|
150
|
+
if (!fc) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// leaflet doesn't repeat features every 360 degrees along longitude
|
|
154
|
+
// so we clone it manually to the direction(s)
|
|
155
|
+
// which could be displayed when auto-zoomed on the feature
|
|
156
|
+
const features = [...fc.features];
|
|
157
|
+
const bb = unwrapBbox(bbox(picked));
|
|
158
|
+
const span = bb[2] - bb[0];
|
|
159
|
+
if (bb[0] - span / 4 < -180) {
|
|
160
|
+
features.push(...shiftPolyCollection(fc, -360).features);
|
|
161
|
+
}
|
|
162
|
+
if (bb[2] + span / 4 > 180) {
|
|
163
|
+
features.push(...shiftPolyCollection(fc, 360).features);
|
|
164
|
+
}
|
|
165
|
+
setData(featureCollection(features));
|
|
166
|
+
});
|
|
142
167
|
}
|
|
143
168
|
else if (picked.geometry.type === "LineString" ||
|
|
144
169
|
picked.geometry.type === "MultiLineString") {
|
|
@@ -200,3 +225,24 @@ export function createLeafletMapController(map, marker = true, showResultMarkers
|
|
|
200
225
|
},
|
|
201
226
|
};
|
|
202
227
|
}
|
|
228
|
+
function shiftPolyCollection(featureCollection, distance) {
|
|
229
|
+
const cloned = clone(featureCollection);
|
|
230
|
+
for (const feature of cloned.features) {
|
|
231
|
+
if (feature.geometry.type == "MultiPolygon") {
|
|
232
|
+
for (const poly of feature.geometry.coordinates) {
|
|
233
|
+
shiftPolyCoords(poly, distance);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
shiftPolyCoords(feature.geometry.coordinates, distance);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return cloned;
|
|
241
|
+
}
|
|
242
|
+
function shiftPolyCoords(coordinates, distance) {
|
|
243
|
+
for (const ring of coordinates) {
|
|
244
|
+
for (const position of ring) {
|
|
245
|
+
position[0] += distance;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -8,8 +8,8 @@ export declare function createMapLibreGlMapController(map: Map, maplibregl?: Map
|
|
|
8
8
|
line?: Pick<LineLayerSpecification, "layout" | "paint" | "filter">;
|
|
9
9
|
}): {
|
|
10
10
|
setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
|
|
11
|
-
flyTo(center: Position, zoom
|
|
12
|
-
fitBounds(bbox: BBox, padding: number, maxZoom
|
|
11
|
+
flyTo(center: Position, zoom?: number): void;
|
|
12
|
+
fitBounds(bbox: BBox, padding: number, maxZoom?: number): void;
|
|
13
13
|
indicateReverse(reverse: boolean): void;
|
|
14
14
|
setReverseMarker(coordinates?: Position): void;
|
|
15
15
|
setMarkers(markedFeatures: Feature[] | undefined, picked: Feature | undefined): void;
|
|
@@ -89,6 +89,9 @@ export function createMapLibreGlMapController(map, maplibregl, marker = true, sh
|
|
|
89
89
|
}
|
|
90
90
|
function setData(data) {
|
|
91
91
|
savedData = data;
|
|
92
|
+
if (!data) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
92
95
|
map.getSource("full-geom")?.setData(data);
|
|
93
96
|
}
|
|
94
97
|
return {
|
|
@@ -103,13 +106,13 @@ export function createMapLibreGlMapController(map, maplibregl, marker = true, sh
|
|
|
103
106
|
}
|
|
104
107
|
},
|
|
105
108
|
flyTo(center, zoom) {
|
|
106
|
-
map.flyTo({ center, zoom, ...flyToOptions });
|
|
109
|
+
map.flyTo({ center, ...(zoom ? { zoom } : {}), ...flyToOptions });
|
|
107
110
|
},
|
|
108
111
|
fitBounds(bbox, padding, maxZoom) {
|
|
109
112
|
map.fitBounds([
|
|
110
113
|
[bbox[0], bbox[1]],
|
|
111
114
|
[bbox[2], bbox[3]],
|
|
112
|
-
], { padding, maxZoom, ...fitBoundsOptions });
|
|
115
|
+
], { padding, ...(maxZoom ? { maxZoom } : {}), ...fitBoundsOptions });
|
|
113
116
|
},
|
|
114
117
|
indicateReverse(reverse) {
|
|
115
118
|
map.getCanvasContainer().style.cursor = reverse ? "crosshair" : "";
|
package/svelte/mask.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Feature, FeatureCollection, MultiPolygon, Polygon } from "geojson";
|
|
2
|
-
export declare function setMask(picked: Feature<Polygon | MultiPolygon>, setData: (data
|
|
2
|
+
export declare function setMask(picked: Feature<Polygon | MultiPolygon>, setData: (data?: FeatureCollection<Polygon | MultiPolygon>) => void): void;
|
package/svelte/mask.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import bbox from "@turf/bbox";
|
|
2
2
|
import difference from "@turf/difference";
|
|
3
|
+
import flatten from "@turf/flatten";
|
|
3
4
|
import { featureCollection, polygon } from "@turf/helpers";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let prev = undefined;
|
|
7
|
-
for (const c of ring) {
|
|
8
|
-
if (prev && c[0] - prev[0] >= 180) {
|
|
9
|
-
c[0] -= 360;
|
|
10
|
-
}
|
|
11
|
-
else if (prev && c[0] - prev[0] < -180) {
|
|
12
|
-
c[0] += 360;
|
|
13
|
-
}
|
|
14
|
-
prev = c;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
5
|
+
import union from "@turf/union";
|
|
6
|
+
import { unwrapBbox } from "./geoUtils";
|
|
17
7
|
export function setMask(picked, setData) {
|
|
18
8
|
const diff = difference(featureCollection([
|
|
19
9
|
polygon([
|
|
@@ -30,22 +20,35 @@ export function setMask(picked, setData) {
|
|
|
30
20
|
if (!diff) {
|
|
31
21
|
return;
|
|
32
22
|
}
|
|
33
|
-
diff.properties = { isMask:
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
diff.properties = { isMask: true };
|
|
24
|
+
const bb = unwrapBbox(bbox(picked));
|
|
25
|
+
// bigger features (continents, oceans) have bigger tolerance
|
|
26
|
+
// because of the used source data simplification
|
|
27
|
+
const tolerance = (bb[2] - bb[0]) / 360 / 1_000;
|
|
28
|
+
const leaksLeft = bb[0] < -180;
|
|
29
|
+
const leaksRight = bb[2] > 180;
|
|
30
|
+
const flattened = flatten(picked);
|
|
31
|
+
if (flattened.features.length > 1 && (leaksLeft || leaksRight)) {
|
|
32
|
+
for (const poly of flattened.features) {
|
|
33
|
+
const bb = unwrapBbox(bbox(poly));
|
|
34
|
+
if (leaksRight && bb[0] < -180 + tolerance) {
|
|
35
|
+
for (const ring of poly.geometry.coordinates) {
|
|
36
|
+
for (const position of ring) {
|
|
37
|
+
position[0] += 360 - tolerance;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (leaksLeft && bb[2] > 180 - tolerance) {
|
|
42
|
+
for (const ring of poly.geometry.coordinates) {
|
|
43
|
+
for (const position of ring) {
|
|
44
|
+
position[0] -= 360 - tolerance;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
setData(featureCollection([
|
|
50
|
+
setData(featureCollection([
|
|
51
|
+
flattened.features.length < 2 ? picked : (union(flattened) ?? picked),
|
|
52
|
+
diff,
|
|
53
|
+
]));
|
|
51
54
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Feature } from "ol";
|
|
2
|
-
import { GeometryCollection as OlGeometryCollection, LineString as OlLineString, MultiLineString as OlMultiLineString, MultiPolygon as OlMultiPolygon, Polygon as OlPolygon,
|
|
1
|
+
import { Feature as OlFeature } from "ol";
|
|
2
|
+
import { GeometryCollection as OlGeometryCollection, LineString as OlLineString, MultiLineString as OlMultiLineString, MultiPolygon as OlMultiPolygon, Point as OlPoint, Polygon as OlPolygon, } from "ol/geom";
|
|
3
3
|
import VectorLayer from "ol/layer/Vector";
|
|
4
4
|
import { fromLonLat, getUserProjection, toLonLat, transformExtent, } from "ol/proj";
|
|
5
5
|
import VectorSource from "ol/source/Vector";
|
|
@@ -133,7 +133,7 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
133
133
|
flyTo(center, zoom) {
|
|
134
134
|
map.getView().animate({
|
|
135
135
|
center: fromLonLat(center, getProjection()),
|
|
136
|
-
zoom,
|
|
136
|
+
...(zoom ? { zoom } : {}),
|
|
137
137
|
duration: 2000,
|
|
138
138
|
...flyToOptions,
|
|
139
139
|
});
|
|
@@ -141,7 +141,7 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
141
141
|
fitBounds(bbox, padding, maxZoom) {
|
|
142
142
|
map.getView().fit(transformExtent(bbox, EPSG_4326, getProjection()), {
|
|
143
143
|
padding: [padding, padding, padding, padding],
|
|
144
|
-
maxZoom,
|
|
144
|
+
...(maxZoom ? { maxZoom } : {}),
|
|
145
145
|
duration: 2000,
|
|
146
146
|
...flyToBounds,
|
|
147
147
|
});
|
|
@@ -162,7 +162,7 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
else if (coordinates) {
|
|
165
|
-
reverseMarker = new
|
|
165
|
+
reverseMarker = new OlFeature(new OlPoint(fromLonLat(coordinates, getProjection())));
|
|
166
166
|
reverseMarker.setProperties({ isReverse: true });
|
|
167
167
|
source.addFeature(reverseMarker);
|
|
168
168
|
}
|
|
@@ -181,7 +181,7 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
181
181
|
if (!geom) {
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
184
|
-
source.addFeature(new
|
|
184
|
+
source.addFeature(new OlFeature({
|
|
185
185
|
isMask: !!f.properties?.isMask,
|
|
186
186
|
geometry: fromWgs84(geom),
|
|
187
187
|
}));
|
|
@@ -191,7 +191,6 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
191
191
|
if (reverseMarker) {
|
|
192
192
|
source.addFeature(reverseMarker);
|
|
193
193
|
}
|
|
194
|
-
setData();
|
|
195
194
|
if (picked) {
|
|
196
195
|
let handled = false;
|
|
197
196
|
if (picked.geometry.type === "GeometryCollection") {
|
|
@@ -203,17 +202,17 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
203
202
|
: null)
|
|
204
203
|
.filter((a) => !!a);
|
|
205
204
|
if (geoms.length > 0) {
|
|
206
|
-
source.addFeature(new
|
|
205
|
+
source.addFeature(new OlFeature(fromWgs84(new OlGeometryCollection(geoms))));
|
|
207
206
|
handled = true;
|
|
208
207
|
}
|
|
209
208
|
else {
|
|
210
209
|
for (const geometry of picked.geometry.geometries) {
|
|
211
210
|
if (geometry.type === "LineString") {
|
|
212
|
-
source.addFeature(new
|
|
211
|
+
source.addFeature(new OlFeature(fromWgs84(new OlLineString(geometry.coordinates))));
|
|
213
212
|
handled = true;
|
|
214
213
|
}
|
|
215
214
|
else if (geometry.type === "MultiLineString") {
|
|
216
|
-
source.addFeature(new
|
|
215
|
+
source.addFeature(new OlFeature(fromWgs84(new OlMultiLineString(geometry.coordinates))));
|
|
217
216
|
}
|
|
218
217
|
handled = true;
|
|
219
218
|
}
|
|
@@ -229,20 +228,20 @@ export function createOpenLayersMapController(map, flyToOptions = {}, flyToBound
|
|
|
229
228
|
setMask(picked, setData);
|
|
230
229
|
}
|
|
231
230
|
else if (picked.geometry.type === "LineString") {
|
|
232
|
-
source.addFeature(new
|
|
231
|
+
source.addFeature(new OlFeature(fromWgs84(new OlLineString(picked.geometry.coordinates))));
|
|
233
232
|
return; // no pin for (multi)linestrings
|
|
234
233
|
}
|
|
235
234
|
else if (picked.geometry.type === "MultiLineString") {
|
|
236
|
-
source.addFeature(new
|
|
235
|
+
source.addFeature(new OlFeature(fromWgs84(new OlMultiLineString(picked.geometry.coordinates))));
|
|
237
236
|
return; // no pin for (multi)linestrings
|
|
238
237
|
}
|
|
239
|
-
source.addFeature(new
|
|
238
|
+
source.addFeature(new OlFeature(fromWgs84(new OlPoint(picked.center))));
|
|
240
239
|
}
|
|
241
240
|
for (const feature of markedFeatures ?? []) {
|
|
242
241
|
if (feature === picked) {
|
|
243
242
|
continue;
|
|
244
243
|
}
|
|
245
|
-
const marker = new
|
|
244
|
+
const marker = new OlFeature(new OlPoint(fromLonLat(feature.center, getProjection())));
|
|
246
245
|
marker.setId(feature.id);
|
|
247
246
|
marker.setProperties({
|
|
248
247
|
fuzzy: !!feature.matching_text,
|
package/svelte/types.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export type MapEvent = {
|
|
|
30
30
|
};
|
|
31
31
|
export type MapController = {
|
|
32
32
|
setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
|
|
33
|
-
flyTo(center: Position, zoom
|
|
34
|
-
fitBounds(bbox: BBox, padding: number, maxZoom
|
|
33
|
+
flyTo(center: Position, zoom?: number): void;
|
|
34
|
+
fitBounds(bbox: BBox, padding: number, maxZoom?: number): void;
|
|
35
35
|
indicateReverse(reverse: boolean): void;
|
|
36
36
|
setMarkers(features: Feature[] | undefined, picked: Feature | undefined): void;
|
|
37
37
|
setReverseMarker(coordinates?: Position): void;
|
|
@@ -129,15 +129,21 @@ export type ControlOptions = {
|
|
|
129
129
|
*/
|
|
130
130
|
fuzzyMatch?: boolean;
|
|
131
131
|
/**
|
|
132
|
-
* On geocoded result what zoom level should the map animate to when a bbox isn't
|
|
133
|
-
* If a bbox is
|
|
134
|
-
*
|
|
132
|
+
* On geocoded result what zoom level should the map animate to when a bbox in the response isn't present or is a point.
|
|
133
|
+
* If a bbox is present and not a point then the map will fit to the bbox.
|
|
134
|
+
*
|
|
135
|
+
* Value can be a number (deprecated) or key-value pairs, where key is a <type> or <type>.<categoy> and value is the zoom level.
|
|
136
|
+
*
|
|
137
|
+
* Default value is `GeocodingControl.ZOOM_DEFAULTS`.
|
|
135
138
|
*/
|
|
136
|
-
zoom?: number
|
|
139
|
+
zoom?: number | Record<string, number>;
|
|
137
140
|
/**
|
|
138
|
-
* On geocoded result what max zoom level should the map animate to when a bbox
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
+
* On geocoded result what max zoom level should the map animate to when a bbox in the response isn't present or is a point.
|
|
142
|
+
* Used for small features.
|
|
143
|
+
*
|
|
144
|
+
* If a bbox is present and not a point then the map will fit to the bbox.
|
|
145
|
+
*
|
|
146
|
+
* @deprecated use `zoom` option
|
|
141
147
|
*/
|
|
142
148
|
maxZoom?: number;
|
|
143
149
|
/**
|
package/types.d.ts
CHANGED
|
@@ -30,8 +30,8 @@ export type MapEvent = {
|
|
|
30
30
|
};
|
|
31
31
|
export type MapController = {
|
|
32
32
|
setEventHandler(handler: undefined | ((e: MapEvent) => void)): void;
|
|
33
|
-
flyTo(center: Position, zoom
|
|
34
|
-
fitBounds(bbox: BBox, padding: number, maxZoom
|
|
33
|
+
flyTo(center: Position, zoom?: number): void;
|
|
34
|
+
fitBounds(bbox: BBox, padding: number, maxZoom?: number): void;
|
|
35
35
|
indicateReverse(reverse: boolean): void;
|
|
36
36
|
setMarkers(features: Feature[] | undefined, picked: Feature | undefined): void;
|
|
37
37
|
setReverseMarker(coordinates?: Position): void;
|
|
@@ -129,15 +129,21 @@ export type ControlOptions = {
|
|
|
129
129
|
*/
|
|
130
130
|
fuzzyMatch?: boolean;
|
|
131
131
|
/**
|
|
132
|
-
* On geocoded result what zoom level should the map animate to when a bbox isn't
|
|
133
|
-
* If a bbox is
|
|
134
|
-
*
|
|
132
|
+
* On geocoded result what zoom level should the map animate to when a bbox in the response isn't present or is a point.
|
|
133
|
+
* If a bbox is present and not a point then the map will fit to the bbox.
|
|
134
|
+
*
|
|
135
|
+
* Value can be a number (deprecated) or key-value pairs, where key is a <type> or <type>.<categoy> and value is the zoom level.
|
|
136
|
+
*
|
|
137
|
+
* Default value is `GeocodingControl.ZOOM_DEFAULTS`.
|
|
135
138
|
*/
|
|
136
|
-
zoom?: number
|
|
139
|
+
zoom?: number | Record<string, number>;
|
|
137
140
|
/**
|
|
138
|
-
* On geocoded result what max zoom level should the map animate to when a bbox
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
+
* On geocoded result what max zoom level should the map animate to when a bbox in the response isn't present or is a point.
|
|
142
|
+
* Used for small features.
|
|
143
|
+
*
|
|
144
|
+
* If a bbox is present and not a point then the map will fit to the bbox.
|
|
145
|
+
*
|
|
146
|
+
* @deprecated use `zoom` option
|
|
141
147
|
*/
|
|
142
148
|
maxZoom?: number;
|
|
143
149
|
/**
|