Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(geomap): let the places the map draws answer a click
Elian Doran06ea84e10ab1
diff --git a/apps/client/src/widgets/collections/geomap/PlacePanel.tsx b/apps/client/src/widgets/collections/geomap/PlacePanel.tsxindex a9dd7a4690..7271211c01 100644--- a/apps/client/src/widgets/collections/geomap/PlacePanel.tsx+++ b/apps/client/src/widgets/collections/geomap/PlacePanel.tsx@@ -61,8 +61,11 @@ export default function PlacePanel({ place, isReadOnly, onAddMarker, onClose }:><OverlayPanelBody className="geo-place-panel-body">{/* The whole of what the geocoder calls the place, the heading above carrying only- its name. */}- <div className="geo-place-panel-address">{place.label}</div>+ its name. A place clicked on the base map is named but not addressed, and the+ line is left out rather than repeating the heading (see Pois). */}+ {place.label !== place.name && (+ <div className="geo-place-panel-address">{place.label}</div>+ )}{/* The pane's own, so a place and a marker offer their coordinates alike. */}<LocationButton coordinates={[ place.lng, place.lat ]} />diff --git a/apps/client/src/widgets/collections/geomap/Pois.spec.tsx b/apps/client/src/widgets/collections/geomap/Pois.spec.tsxnew file mode 100644index 0000000000..c3ffe0a9ae--- /dev/null+++ b/apps/client/src/widgets/collections/geomap/Pois.spec.tsx@@ -0,0 +1,274 @@+/**+ * The places the base map draws answering a click: which tile features are worth standing the map on,+ * which layers are hit-tested for them, and what the map's own markers do to a click that lands on+ * both.+ */+import type { Map as MapLibreGLMap, MapGeoJSONFeature } from "maplibre-gl";+import { render } from "preact";+import { act } from "preact/test-utils";+import { afterEach, describe, expect, it } from "vitest";++import { CLUSTER_LAYER } from "./clusters";+import type { GeoSearchResult } from "./geocoding";+import { MapStyleLoaded, ParentMap } from "./map";+import { MARKER_LAYER } from "./Markers";+import Pois, { poiFromFeature, poiLayers } from "./Pois";++type Listener = (e?: unknown) => void;++/** A place as a tile carries one: named, classified by its OSM tags, standing at a point. */+function poiFeature(properties: Record<string, unknown>, coordinates: [number, number] = [ 13.4, 52.5 ]) {+ return {+ id: 42,+ geometry: { type: "Point", coordinates },+ properties+ } as unknown as MapGeoJSONFeature;+}++/**+ * A map whose style draws places, standing in for MapLibre. What it has to answer is the hit test:+ * what the click landed on, told apart by which layers the query names.+ */+function fakeMap({ poiLayerIds = [ "poi-amenity", "poi-shop" ], ownLayerIds = [ MARKER_LAYER ], zoom = 18 } = {}) {+ const listeners = new Map<string, Set<Listener>>();+ const canvas = { style: { cursor: "" } };+ let onPoi: unknown[] = [];+ let onOwn: unknown[] = [];++ const layers = new Map<string, { sourceLayer: string }>();+ for (const id of poiLayerIds) layers.set(id, { sourceLayer: "pois" });+ for (const id of ownLayerIds) layers.set(id, { sourceLayer: "" });++ return {+ get cursor() { return canvas.style.cursor; },+ /** How far the map is zoomed in, which is what settles whether its places can be seen at all. */+ setZoom(to: number) { zoom = to; },+ /** What the next click lands on: a place of the base map, something of the map's own, or both. */+ setUnderPointer({ poi = [] as unknown[], own = [] as unknown[] }) {+ onPoi = poi;+ onOwn = own;+ },+ click() {+ for (const fn of listeners.get("click") ?? []) fn({ point: { x: 0, y: 0 } });+ },+ /** The pointer arriving over one of the layers the cursor is bound to, and leaving it again. */+ hover(layer: string) {+ for (const fn of listeners.get(`mouseenter:${layer}`) ?? []) fn();+ },+ unhover(layer: string) {+ for (const fn of listeners.get(`mouseleave:${layer}`) ?? []) fn();+ },+ /** Which layers the cursor is currently bound to, as a style switch has to put back. */+ boundLayers() {+ return [ ...listeners.keys() ]+ .filter((key) => key.startsWith("mouseenter:") && (listeners.get(key)?.size ?? 0) > 0)+ .map((key) => key.slice("mouseenter:".length));+ },+ fireStyleLoad() {+ for (const fn of listeners.get("style.load") ?? []) fn();+ },+ on(event: string, fnOrLayer: unknown, fn?: Listener) {+ const key = fn ? `${event}:${fnOrLayer}` : event;+ if (!listeners.has(key)) listeners.set(key, new Set());+ listeners.get(key)?.add((fn ?? fnOrLayer) as Listener);+ },+ off(event: string, fnOrLayer: unknown, fn?: Listener) {+ listeners.get(fn ? `${event}:${fnOrLayer}` : event)?.delete((fn ?? fnOrLayer) as Listener);+ },+ queryRenderedFeatures(_point: unknown, { layers: queried }: { layers: string[] }) {+ return queried.some((id) => poiLayerIds.includes(id)) ? onPoi : onOwn;+ },+ getLayersOrder: () => [ ...layers.keys() ],+ getLayer: (id: string) => layers.get(id),+ getCanvas: () => canvas,+ getZoom: () => zoom+ };+}++const containers: HTMLElement[] = [];++/** Puts the places of a map within reach, and hands back what a click on one reported. */+async function renderPois(map: ReturnType<typeof fakeMap>, { placing = false } = {}) {+ const container = document.createElement("div");+ document.body.appendChild(container);+ containers.push(container);++ const picked: GeoSearchResult[] = [];++ await act(async () => {+ render(+ <ParentMap.Provider value={map as unknown as MapLibreGLMap}>+ <MapStyleLoaded.Provider value={true}>+ <Pois placing={placing} onPick={(place) => picked.push(place)} />+ </MapStyleLoaded.Provider>+ </ParentMap.Provider>,+ container+ );+ });++ return {+ picked,+ unmount: async () => { await act(async () => { render(null, container); }); }+ };+}++afterEach(() => {+ for (const container of containers) {+ render(null, container);+ container.remove();+ }+ containers.length = 0;+});++describe("geo map POI features", () => {+ it("reads a named place off a tile feature, classified by its OSM tags", () => {+ const place = poiFromFeature(poiFeature({ name: "Café Kranzler", amenity: "cafe" }));++ expect(place).toMatchObject({+ name: "Café Kranzler",+ // Nothing beyond the name, a tile carrying no address (see PlacePanel).+ label: "Café Kranzler",+ lng: 13.4,+ lat: 52.5,+ icon: "bx bx-coffee"+ });+ // Named by what OSM calls the place, so the same one clicked twice is the same place.+ expect(place?.id).toBe("poi:42");+ });++ it("names a place the way the rest of the map is named", () => {+ // The styles load their English variant, so a place says what its label would have said.+ const place = poiFromFeature(poiFeature({ name: "東京タワー", name_en: "Tokyo Tower", tourism: "attraction" }));++ expect(place?.name).toBe("Tokyo Tower");+ });++ it("falls through the tags to whichever kind the place is filed under", () => {+ expect(poiFromFeature(poiFeature({ name: "Edeka", shop: "supermarket" }))?.icon).toBe("bx bx-cart");+ // A kind the tables do not name is still drawn by its category, a shop as a shop.+ expect(poiFromFeature(poiFeature({ name: "Rossmann", shop: "chemist" }))?.icon).toBe("bx bx-store");+ // Every key a place can be filed under has an icon, so only a feature carrying no kind at+ // all is left for the panel to fall back on.+ expect(poiFromFeature(poiFeature({ name: "Something" }))?.icon).toBeUndefined();+ });++ it("passes over what is not a place worth keeping", () => {+ // A bench has no name, and the bare OSM tag is not what anyone means to keep.+ expect(poiFromFeature(poiFeature({ amenity: "bench" }))).toBeNull();+ expect(poiFromFeature(poiFeature({ name: " ", amenity: "cafe" }))).toBeNull();+ expect(poiFromFeature(undefined)).toBeNull();+ expect(poiFromFeature({+ geometry: { type: "LineString", coordinates: [] },+ properties: { name: "A street" }+ } as unknown as MapGeoJSONFeature)).toBeNull();+ });++ it("hit-tests the layers of the style that draw places, and no others", () => {+ const map = fakeMap({ poiLayerIds: [ "poi-amenity" ], ownLayerIds: [ MARKER_LAYER, CLUSTER_LAYER ] });++ expect(poiLayers(map as unknown as MapLibreGLMap)).toEqual([ "poi-amenity" ]);+ });+});++describe("geo map Pois", () => {+ it("stands the map on the place a click landed on", async () => {+ const map = fakeMap();+ const { picked } = await renderPois(map);++ map.setUnderPointer({ poi: [ poiFeature({ name: "Café Kranzler", amenity: "cafe" }) ] });+ await act(async () => { map.click(); });++ expect(picked).toHaveLength(1);+ expect(picked[0]).toMatchObject({ name: "Café Kranzler", icon: "bx bx-coffee" });+ });++ it("leaves a click that landed on the map's own to the map's own", async () => {+ const map = fakeMap();+ const { picked } = await renderPois(map);++ // A marker standing over a place: the pin is the smaller target and the one aimed at.+ map.setUnderPointer({+ poi: [ poiFeature({ name: "Café Kranzler", amenity: "cafe" }) ],+ own: [ { properties: { id: "note1" } } ]+ });+ await act(async () => { map.click(); });++ expect(picked).toEqual([]);+ });++ it("leaves the click alone while one is armed to place a marker", async () => {+ const map = fakeMap();+ const { picked } = await renderPois(map, { placing: true });++ map.setUnderPointer({ poi: [ poiFeature({ name: "Café Kranzler", amenity: "cafe" }) ] });+ await act(async () => { map.click(); });++ expect(picked).toEqual([]);+ // Nor does the pointer offer a place while the click means somewhere to put a marker.+ expect(map.boundLayers()).toEqual([]);+ });++ it("leaves the places alone until the map has drawn them", async () => {+ const map = fakeMap();+ const { picked } = await renderPois(map);++ // The styles fade their places in over the zoom above 16, and what cannot be seen is not+ // what a click was aimed at.+ map.setZoom(16);+ map.setUnderPointer({ poi: [ poiFeature({ name: "Café Kranzler", amenity: "cafe" }) ] });+ await act(async () => { map.click(); });+ map.hover("poi-amenity");++ expect(picked).toEqual([]);+ expect(map.cursor).toBe("");++ map.setZoom(17);+ await act(async () => { map.click(); });+ map.hover("poi-amenity");++ expect(picked).toHaveLength(1);+ expect(map.cursor).toBe("pointer");+ });++ it("does nothing on a style that draws no places", async () => {+ // The raster layer has its places baked into the image, and Neutrino carries none.+ const map = fakeMap({ poiLayerIds: [] });+ const { picked } = await renderPois(map);++ map.setUnderPointer({ poi: [ poiFeature({ name: "Café Kranzler", amenity: "cafe" }) ] });+ await act(async () => { map.click(); });++ expect(picked).toEqual([]);+ });++ it("says a place can be clicked, and puts the pointer back when it goes", async () => {+ const map = fakeMap();+ const { unmount } = await renderPois(map);++ map.hover("poi-amenity");+ expect(map.cursor).toBe("pointer");++ map.unhover("poi-amenity");+ expect(map.cursor).toBe("");++ map.hover("poi-shop");+ await unmount();+ // Torn down with the pointer sitting on a place, the `mouseleave` no longer being listened for.+ expect(map.cursor).toBe("");+ expect(map.boundLayers()).toEqual([]);+ });++ it("puts the pointer back on the layers a style switch brought in", async () => {+ const map = fakeMap();+ await renderPois(map);++ expect(map.boundLayers()).toEqual([ "poi-amenity", "poi-shop" ]);++ // The layers are replaced wholesale, so the handlers are bound once each rather than twice.+ await act(async () => { map.fireStyleLoad(); });++ expect(map.boundLayers()).toEqual([ "poi-amenity", "poi-shop" ]);+ map.hover("poi-amenity");+ expect(map.cursor).toBe("pointer");+ });+});diff --git a/apps/client/src/widgets/collections/geomap/Pois.tsx b/apps/client/src/widgets/collections/geomap/Pois.tsxnew file mode 100644index 0000000000..588f7df98f--- /dev/null+++ b/apps/client/src/widgets/collections/geomap/Pois.tsx@@ -0,0 +1,183 @@+import type { Map as MapLibreGLMap, MapGeoJSONFeature, MapMouseEvent } from "maplibre-gl";+import { useContext, useEffect } from "preact/hooks";++import { CLUSTER_LAYERS } from "./clusters";+import type { GeoSearchResult } from "./geocoding";+import { trackHitLayers } from "./GpxTrack";+import { MapStyleLoaded, ParentMap } from "./map";+import { MARKER_LAYER } from "./Markers";+import { placeIcon } from "./osm_icons";+import { PLACE_LAYER } from "./PlaceMarker";++/** The source layer the vector styles draw shops, cafes and the rest of the base map's places from. */+const POI_SOURCE_LAYER = "pois";++/**+ * The zoom a place answers a click from. The styles put their places on at zoom 16 but fade them in+ * over the zoom that follows, and a place that cannot yet be seen is not one anybody means to click.+ */+const MIN_POI_ZOOM = 17;++/**+ * The OSM keys a tile classifies a place by, in the order the styles draw them. A feature carries at+ * most a few of these, and the first one present is what the place is.+ */+const POI_TAG_KEYS = [+ "amenity",+ "leisure",+ "tourism",+ "shop",+ "man_made",+ "historic",+ "emergency",+ "highway",+ "office"+];++interface PoisProps {+ /** A click is armed to place a marker, so it does not also mean "tell me about this place". */+ placing: boolean;+ /** Reports the place clicked on the base map, for the caller to stand the map on. */+ onPick(place: GeoSearchResult): void;+}++/**+ * Makes the places the base map already draws — a cafe, a pharmacy, a museum — answer a click.+ *+ * The vector styles draw them from the `pois` source layer, which carries each place's name and the+ * OSM tags that say what kind of place it is. Both are read out of the tile the map has already+ * downloaded, so a click costs no request and the place can be kept as a marker without typing its+ * name (see `keepPlaceAsMarker` in index.tsx).+ *+ * Nothing to draw of its own: a picked place is handed back and stands under the same pin and panel a+ * searched one does (see PlaceMarker and PlacePanel).+ *+ * The raster layer has its places baked into the image and Neutrino carries none, so there is nothing+ * to hit-test under either and a click falls through to what it meant before.+ */+export default function Pois({ placing, onPick }: PoisProps) {+ const parentMap = useContext(ParentMap);+ const styleLoaded = useContext(MapStyleLoaded);++ useEffect(() => {+ if (!parentMap || placing) return;+ // Aliased so the narrowing above carries into the handler below.+ const map = parentMap;++ const onClick = (e: MapMouseEvent) => {+ if (map.getZoom() < MIN_POI_ZOOM) return;++ const layers = poiLayers(map);+ if (!layers.length) return;++ // A marker, a cluster or a track stands above the base map and answers the click first.+ const own = ownLayers(map);+ if (own.length && map.queryRenderedFeatures(e.point, { layers: own }).length) return;++ const place = poiFromFeature(map.queryRenderedFeatures(e.point, { layers })[0]);+ if (place) {+ onPick(place);+ }+ };++ map.on("click", onClick);+ return () => { map.off("click", onClick); };+ }, [ parentMap, placing, onPick ]);++ // The pointer is what says a place can be clicked: the base map draws it as an icon like any+ // other, and nothing else about it invites a click.+ useEffect(() => {+ if (!parentMap || placing) return;+ // Aliased so the narrowing above carries into the functions below.+ const map = parentMap;+ let bound: string[] = [];++ const setCursor = (cursor: string) => { map.getCanvas().style.cursor = cursor; };+ const onEnter = () => {+ if (map.getZoom() >= MIN_POI_ZOOM) {+ setCursor("pointer");+ }+ };+ const onLeave = () => setCursor("");++ function unbind() {+ for (const layer of bound) {+ map.off("mouseenter", layer, onEnter);+ map.off("mouseleave", layer, onLeave);+ }+ bound = [];+ }++ function bind() {+ unbind();+ bound = poiLayers(map);+ for (const layer of bound) {+ map.on("mouseenter", layer, onEnter);+ map.on("mouseleave", layer, onLeave);+ }+ }++ bind();+ // Switching the style replaces every layer the handlers were bound to.+ map.on("style.load", bind);++ return () => {+ map.off("style.load", bind);+ unbind();+ // The pointer is put back by hand, since this can be torn down while it sits on a place+ // and the `mouseleave` that would have cleared it is no longer listened for.+ setCursor("");+ };+ }, [ parentMap, placing, styleLoaded ]);++ return null;+}++/**+ * The place a tile feature stands for, or `null` where it is not one worth standing the map on.+ *+ * A place with no name is skipped: what names a marker would be the bare OSM tag, and "Bench" is not+ * what anyone means to keep. The click then falls through to what it meant before.+ */+export function poiFromFeature(feature: MapGeoJSONFeature | undefined): GeoSearchResult | null {+ if (feature?.geometry.type !== "Point") {+ return null;+ }++ const properties = feature.properties ?? {};+ // The styles load their English variant, so a place is named the way the rest of the map is.+ const name = String(properties.name_en || properties.name || "").trim();+ if (!name) {+ return null;+ }++ const [ lng, lat ] = feature.geometry.coordinates;+ const category = POI_TAG_KEYS.find((key) => properties[key]);++ return {+ id: `poi:${feature.id ?? `${lng},${lat}`}`,+ name,+ // A tile carries no address, so the panel has nothing to say under the name (see PlacePanel).+ label: name,+ lat,+ lng,+ icon: placeIcon({ category, type: category ? String(properties[category]) : undefined })+ };+}++/**+ * The layers of the current style that draw places, for hit-testing against.+ *+ * Read off the style each time rather than remembered: the styles name these layers differently, and+ * `queryRenderedFeatures` answers nothing at all — rather than skipping the one it cannot find — if a+ * single named layer is missing.+ */+export function poiLayers(map: MapLibreGLMap) {+ return map.getLayersOrder().filter((id) => map.getLayer(id)?.sourceLayer === POI_SOURCE_LAYER);+}++/** The layers the map draws its own notes and tracks on, which stand above the base map. */+function ownLayers(map: MapLibreGLMap) {+ return [ MARKER_LAYER, PLACE_LAYER, ...CLUSTER_LAYERS, ...trackHitLayers(map) ]+ .filter((id) => map.getLayer(id));+}diff --git a/apps/client/src/widgets/collections/geomap/index.tsx b/apps/client/src/widgets/collections/geomap/index.tsxindex 1160b55790..6b8cd91230 100644--- a/apps/client/src/widgets/collections/geomap/index.tsx+++ b/apps/client/src/widgets/collections/geomap/index.tsx@@ -27,6 +27,7 @@ import type { GeoSearchResult } from "./geocoding";import Markers, { DEFAULT_MARKER_COLOR, LOCATION_ATTRIBUTE } from "./Markers";import PlaceMarker from "./PlaceMarker";import PlacePanel from "./PlacePanel";+import Pois from "./Pois";import ResultNavigator from "./ResultNavigator";import type { SearchResult } from "./results";import SearchBox from "./SearchBox";@@ -403,6 +404,9 @@ export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewM{/* Stood up only while the view is leaned over, so the 3D button changes the mapand not merely the angle it is seen from. */}<Buildings isDarkTheme={layerData.isDarkTheme ?? false} />+ {/* The places the base map itself draws answer a click, which is a marker named and+ placed without typing either (see Pois). */}+ <Pois placing={!!placement} onPick={pickPlace} />{/* The pane above is what a click on a marker opens now, so the markers no longeropen the note themselves — the two would otherwise both answer the same click,raising the quick editor over the pane that had just opened behind it. */}diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Geo Map.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Geo Map.htmlindex dc6d886bfc..ad28d5d04b 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Geo Map.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Collections/Geo Map.html@@ -11,6 +11,7 @@text.</li><li>Search the notes already on the map, and look up places anywhere in theworld.</li>+ <li>Turn a place the map already shows into a marker by clicking it.</li><li>Display tracks on the map using <code spellcheck="false">.gpx</code> files.</li><li>3D view of the map, which displays buildings when using a vector map.</li></ul>@@ -174,6 +175,34 @@<p>Dragging existing notes only works if the map is in editing mode. Seethe <em>Read-only</em> section for more information.</p></aside>+<h3>Adding a note from a place the map already shows</h3>+<p>When a vector map style is used, the map itself draws the shops, cafés,+ museums and other places around the area being viewed. Once the map is+ zoomed in far enough for these to be drawn, they can be clicked:</p>+<ol>+ <li>Click one of the place icons drawn by the map. The mouse cursor turns+ into a pointer over the ones that can be clicked.</li>+ <li>The same panel used for a searched place appears, showing the place's+ name and its coordinates, and a pin is placed on it.</li>+ <li>Press <em>Add as marker</em> to keep it. The note is created with the+ place's name as its title, and the icon matching the kind of place it+ is.</li>+</ol>+<p>Places are read from the map data that has already been downloaded, so+ clicking one does not send anything to the internet.</p>+<p>Some things to keep in mind:</p>+<ul>+ <li>Places that have no name in the map data, such as benches or parking+ spaces, are not clickable. Clicking them does nothing, as clicking the+ map elsewhere.</li>+ <li>The markers of the map take precedence: where one stands over a place,+ clicking it opens the note, not the place.</li>+ <li>This does not work with the raster (OpenStreetMap) style, whose places+ are part of the map image, nor with the <em>Neutrino</em> style, which+ draws no places.</li>+ <li>In read-only mode a place can still be clicked and read, but not kept+ as a marker.</li>+</ul><h2>How the location of the markers is stored</h2><p>The location of a marker is stored in the <code spellcheck="false">#geolocation</code> attributeof the child notes:</p>@@ -360,8 +389,9 @@ class="admonition note"><li>The add button at the bottom of the map.</li><li>Repositioning markers.</li><li>Editing from the contextual menu (removing locations or adding new items).</li>- <li>Keeping a place found by searching as a marker. The search itself still- works, and a place can still be looked at and its coordinates copied.</li>+ <li>Keeping a place as a marker, whether it was found by searching or clicked+ on the map. Both still work, and a place can still be looked at and its+ coordinates copied.</li></ul><p>To set a map as read-only, go to <a class="reference-link" href="#root/_help_8YBEPzcpUgxw">Note buttons</a> → <em>Editable</em> → <em>Read-only</em> (onthe new layout, or in Basic Properties on the <a class="reference-link"diff --git a/docs/User Guide/User Guide/Collections/Geo Map.md b/docs/User Guide/User Guide/Collections/Geo Map.mdindex 6b7da9afba..5f9ec07218 100644--- a/docs/User Guide/User Guide/Collections/Geo Map.md+++ b/docs/User Guide/User Guide/Collections/Geo Map.md@@ -7,6 +7,7 @@ This note type displays the children notes on a geographical map, based on an at* Add markers on the map, which can be customized with icons, colors and text.* Search the notes already on the map, and look up places anywhere in the world.+* Turn a place the map already shows into a marker by clicking it.* Display tracks on the map using `.gpx` files.* 3D view of the map, which displays buildings when using a vector map.@@ -123,6 +124,23 @@ This works for:> [!NOTE]> Dragging existing notes only works if the map is in editing mode. See the _Read-only_ section for more information.+### Adding a note from a place the map already shows++When a vector map style is used, the map itself draws the shops, cafés, museums and other places around the area being viewed. Once the map is zoomed in far enough for these to be drawn, they can be clicked:++1. Click one of the place icons drawn by the map. The mouse cursor turns into a pointer over the ones that can be clicked.+2. The same panel used for a searched place appears, showing the place's name and its coordinates, and a pin is placed on it.+3. Press _Add as marker_ to keep it. The note is created with the place's name as its title, and the icon matching the kind of place it is.++Places are read from the map data that has already been downloaded, so clicking one does not send anything to the internet.++Some things to keep in mind:++* Places that have no name in the map data, such as benches or parking spaces, are not clickable. Clicking them does nothing, as clicking the map elsewhere.+* The markers of the map take precedence: where one stands over a place, clicking it opens the note, not the place.+* This does not work with the raster (OpenStreetMap) style, whose places are part of the map image, nor with the _Neutrino_ style, which draws no places.+* In read-only mode a place can still be clicked and read, but not kept as a marker.+## How the location of the markers is storedThe location of a marker is stored in the `#geolocation` attribute of the child notes:@@ -252,7 +270,7 @@ When a map is [read-only](../Basic%20Concepts%20and%20Features/Notes/Read-Only%2* The add button at the bottom of the map.* Repositioning markers.* Editing from the contextual menu (removing locations or adding new items).-* Keeping a place found by searching as a marker. The search itself still works, and a place can still be looked at and its coordinates copied.+* Keeping a place as a marker, whether it was found by searching or clicked on the map. Both still work, and a place can still be looked at and its coordinates copied.To set a map as read-only, go to <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Note%20buttons.md">Note buttons</a> → _Editable_ → _Read-only_ (on the new layout, or in Basic Properties on the <a class="reference-link" href="../Basic%20Concepts%20and%20Features/UI%20Elements/Ribbon.md">Ribbon</a> for the old layout).