You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make icons a bit bolder to match the search icon which is paths of a certain width
Add disabled support to search control. Bound to checked, but not bound to hidden.
Update linux screenshots due to bolding of zoom, reload controls to match magnifying glass search control icon boldness.
Remove now out of date win32 screenshots for same reason
Make calculation of total size of controls omit the search control mostly, for backwards compatibility
Add waitUntil: 'networkidle', increase some timeouts to de-flake some tests
Implement custom search handler. Use geoname search as example.
Add search example using geonames.org
Search panel grabs focus on mouseenter
Add localization messages for search button.
Add localization and non-Latin character search tests.
Add second search layer to index.html mapml-viewer (multiple search link handler)
Change search default
- clicking a suggestion triggers a search, navigation
- panel stays open until user dismisses it
- panel now requires 2 Esc / clicks to close it
- update broken tests
Simplify search events' API
Add HTMLMapmlViewerElement.zoomToExtent(xmin,ymin,xmax,ymax) to support documentation change for custom search handler development
De-flake a test
Update markup skills to add search controlslist token
Copy file name to clipboardExpand all lines: .github/skills/map-link-markup/SKILL.md
+204Lines changed: 204 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,8 @@ defines several uses of existing and new `rel` keyword values.
37
37
|`zoomout`| The link `href` is followed automatically by the polyfill when the map is zoomed out by the user to a value less than the minimum value of the zoom range of the current layer. The referenced map layer resource replaces the current map layer. The polyfill does not represent this link as a user-visible affordance, it is followed automatically. If the remote resource does not contain a reciprocal `zoomin` link, the map state change is one-way i.e. the layer is permanently replaced. |
38
38
|`legend`| The `legend` link relation designates a link to metadata, typically an image, describing the symbology used by the current layer. Currently, the polyfill creates a hyperlink for the label of the layer in the layer control, which opens in a new browsing context. |
39
39
|`query`| The `query` link relation is used in combination with the `tref="..."` attribute to establish a URL template that composes a map query URL based on user map gestures such as click or touch. These URLs are fetched and the response presented on top of the map as a popup. Such queries can return text/html or text/mapml responses. In the latter case, the response may contain more than one feature, in which case a 'paged' popup is generated, allowing the user to cycle through the features' individual metadata. |
40
+
|`search`| The `search` link relation is used with the `tref="..."` attribute to define a URL template for a search endpoint. The template must contain the `{searchTerms}` variable reference, which is replaced with the user's URL-encoded search query. The search is triggered when the user presses Enter or clicks a suggestion. The response is expected to be a GeoJSON `FeatureCollection` (the default handler format). Only the first `<map-link rel="search">` per `<map-layer>` is honored. The link must be a direct child of `<map-layer>` (for local/inline layers) or placed inside `<map-head>` (for remote `.mapml` layers). The search control is opt-in via `controlslist="search"` on the `<mapml-viewer>` or `<map is="web-map">` element. The search button is disabled when no visible (checked) layer provides a `<map-link rel="search">`. |
41
+
|`suggestions`| The `suggestions` link relation is used with the `tref="..."` attribute to define a URL template for a suggestions/autocomplete endpoint. Like `search`, the template must contain the `{searchTerms}` variable reference. Suggestions are fetched automatically as the user types (debounced, minimum 2 characters). The default handler expects a GeoJSON `FeatureCollection` response, rendering each feature as a clickable result button (using `properties.display_name` or `properties.name`). Only the first `<map-link rel="suggestions">` per `<map-layer>` is honored. Suggestions are optional — if no `rel="suggestions"` link exists, only Enter triggers a search. |
40
42
|`stylesheet`| The link imports a CSS stylesheet from the `href` value. |
41
43
42
44
@@ -135,4 +137,206 @@ Projection values [defined by the polyfill](../mapml-viewer#projection) include:
135
137
</map-extent>
136
138
</layer->
137
139
</mapml-viewer>
140
+
```
141
+
142
+
### Search and Suggestions
143
+
144
+
The search control is opt-in: add `controlslist="search"` to your `<mapml-viewer>`
145
+
or `<map is="web-map">` element. A magnifying-glass button appears in the
146
+
top-left controls. The button is disabled (grayed out, `aria-disabled="true"`)
147
+
when no visible (checked) `<map-layer>` has a descendant `<map-link rel="search">`.
148
+
149
+
The `{searchTerms}` template variable in `tref` is the only required variable.
150
+
It is replaced with the user's URL-encoded query string. No sibling
151
+
`<map-input>` elements are needed for search/suggestions links.
152
+
153
+
#### Placement rules
154
+
155
+
-**Inline (local) layers:** place `<map-link rel="search">` and
156
+
`<map-link rel="suggestions">` as direct children of `<map-layer>`.
157
+
-**Remote layers (`.mapml` files):** place them inside `<map-head>`.
158
+
- Do **not** place search/suggestions links inside `<map-extent>`.
159
+
- Only the **first**`<map-link rel="search">` and first
160
+
`<map-link rel="suggestions">` per `<map-layer>` are honored.
161
+
- Multiple layers may each contribute their own search/suggestions links;
162
+
responses are merged.
163
+
164
+
#### Default handler format (GeoJSON)
165
+
166
+
The default handler expects a **GeoJSON `FeatureCollection`** response from
167
+
both search and suggestions endpoints. Each `Feature` should include:
168
+
169
+
-`geometry` with coordinates (used for `setView` fallback)
170
+
-`bbox` (4-element array `[west, south, east, north]`; used for `fitBounds`)
171
+
-`properties.display_name` or `properties.name` (rendered as button text)
172
+
173
+
This format is compatible with Nominatim (`format=geojson`) and Photon out of
Copy file name to clipboardExpand all lines: .github/skills/mapml-viewer-markup/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ The default projection is `OSMTILE`.
79
79
80
80
### `controlslist`
81
81
82
-
`controlslist` - an enumerated attribute, possible values are: "`nofullscreen`", "`nolayer`", "`noreload`", "`noscale`" and "`nozoom`". Occasionally, you may not want your users to have access to a particular control, so you may prune the set of controls automatically presented (when you have used the `controls` boolean attribute).
82
+
`controlslist` - an enumerated attribute, possible values are: "`nofullscreen`", "`nolayer`", "`noreload`", "`noscale`", "`nozoom`", "`geolocation`" and "`search`". The `no*` tokens let you prune the set of controls automatically presented (when you have used the `controls` boolean attribute), while unlike the `no*` tokens (which hide default controls), the `geolocation` and `search` tokens are **opt-in**. `geolocation` and `search` add location and search controls to the map, respectively. The search control is `disabled` by default, and becomes enabled only when at least one `checked`[`<map-layer>`](../layer/) contains a [`<map-link rel="search">`](../link/) element.
0 commit comments