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
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
0 commit comments