Clew Manual

Reading mode

Interactive maps

A ```leaflet fence turns into a live, pannable map when the note renders: real cartography, clickable markers, regions, tracks, and photo pins. Clew builds most of the Obsidian Leaflet plugin's surface directly into the app — no plugin to install — and adds a few things of its own, most notably photo maps that pin every geotagged photo in a folder. Because a map is just a code fence, it lives in the note like any other text: it travels with the vault, diffs cleanly in git, and survives every other editor untouched.

A first map

A map is a fenced code block whose language is leaflet. Inside the fence, one option per line, in key: value form. The essentials are a centre (lat and long), a zoom level, and optionally a height:

You write

```leaflet
lat: 51.5074
long: -0.1278
zoom: 13
height: 380
marker: 51.5007, -0.1246, Westminster
marker: 51.5194, -0.1270, The British Museum
marker: 51.5145, -0.1163, [[Welcome|The LSE]]
```

Switch the note to reading mode and the fence becomes a map of central London with three pins. Pan by dragging, zoom with the scroll wheel or the +/− control, and click a pin to open its popup. A marker line is marker: lat, long followed by an optional third field: plain text becomes a popup label, and a [[wikilink]] becomes a popup link that opens the note when clicked (⌘-click opens it in a new tab). The [[Note|display text]] form works exactly as it does in prose, so the popup can say something friendlier than the file name.

An interactive Leaflet map rendered inside a note, with several markers and map controls
A ```leaflet fence in reading mode (demo vault, Features/Maps): live tiles, pan and zoom, and markers whose popups can link to notes in the vault.

Map tiles stream from the network, so viewing a map needs a connection. The one fully offline variety is the image-based map, which renders from a file in your vault.

Note Every option name is case-insensitive (maxZoom and maxzoom are the same key), unknown keys are ignored, and a line that does not parse is skipped rather than breaking the map. A fence with no lat/long at all is fine too: the map fits itself around whatever markers it has.

Cartography and tile servers

The default cartography is OpenStreetMap's classic rendering. Five other named styles are built in; pick one with tiles: (or its alias style:). A caution about the CARTO styles: CARTO began watermarking keyless requests with "API KEY REQUIRED" tiles, so voyager, light and dark are best pointed at your own key-fronting proxy via tileServer:.

StyleSourceCharacter
osmOpenStreetMapThe default: the classic OpenStreetMap rendering.
voyagerCARTOClear, modern, Google-Maps-like cartography.
lightCARTONear-white minimal basemap — good under dense marker sets.
darkCARTODark basemap that matches Clew's dark theme natively.
satelliteEsriAerial imagery.
terrainOpenTopoMapTopographic style with contour lines and hillshading.

When Clew is in its dark theme, light tile styles are automatically dimmed so the map sits comfortably in the page; styles that are already dark or photographic (dark, satellite) are left alone. The darkMode key from the Obsidian Leaflet plugin is accepted for compatibility, but in Clew the theme handling is automatic.

Beyond the named styles, tileServer: accepts any standard {z}/{x}/{y} tile URL template — a self-hosted tile server, a historical-map provider, a game map. Two companions refine it: tileOverlay: (repeatable) draws additional semi-transparent tile layers over the base map, and tileSubdomains: supplies the subdomain letters for servers that use a {s} placeholder.

You write

```leaflet
lat: 46.4
long: 8.0
zoom: 10
tiles: terrain
```

Markers

The full form of a marker line is:

You write

marker: [type,] lat, long [, label or [[wikilink]] or [[wikilink|label]]]

The optional leading type colours the marker. Seven named colours render as filled dots — red, orange, yellow, green, teal, blue, purple — which is enough to build a simple legend (red for restaurants, blue for museums). The type default, and any name Clew does not recognize, falls back to the standard pin.

You write

marker: red, 41.8902, 12.4922, [[Colosseum]]
marker: blue, 41.9022, 12.4539, Vatican Museums
marker: 41.8986, 12.4769, Largo di Torre Argentina

Markers gathered from your notes

Listing coordinates by hand is fine for three pins; it does not scale to a travel journal. Three repeatable options gather markers from the frontmatter of other notes instead, so the map stays in one place while the data lives where it belongs:

markerFile: [[Note]]
Adds a pin for one specific note.
markerFolder: Trips
Adds a pin for every note in a folder (searched recursively).
markerTag: #travel
Adds a pin for every note in the vault whose frontmatter tags: include the tag.

A note earns a pin by carrying a location property; two further properties are optional:

You write (in the pinned note's frontmatter)

---
location: [41.8902, 12.4922]
mapmarker: red
map-label: The Colosseum
---

location is the coordinate pair (the brackets are optional); mapmarker is a marker type, exactly as in a marker: line; map-label overrides the popup text, which otherwise defaults to the note's name. Every gathered marker links back to its note, so the map doubles as a spatial index: click the pin, read the note.

You write

```leaflet
markerFolder: Trips
markerTag: #travel
height: 420
```
Caution markerTag matches tags in a note's frontmatter only — the inline tags: [travel, italy] array or the YAML list form. Inline #travel hashtags in the body of a note are not scanned. Markers are also gathered when the note containing the map renders, so a location added to another note shows up the next time the map's note is re-rendered, not instantaneously.

Regions, tracks, and overlays

Three kinds of geometry can be drawn over the base map, each loaded from a file in the vault (referenced by [[wikilink]] or a plain path, all repeatable):

You write

```leaflet
gpx: [[Attachments/coast-walk.gpx]]
gpxColor: teal
overlay: red, 51.5007, -0.1246, 500m, Search area
zoomFeatures: true
```

With zoomFeatures: true the map frames itself around the loaded GeoJSON and GPX geometry instead of using lat/long/zoom — handy when the track is the point of the map.

Finally, imageOverlay: pins an image from the vault onto real-world coordinates — a scanned historical map over the modern city, a site plan over the satellite view:

You write

imageOverlay: [[rome-1748.png]], [[41.8, 12.4], [41.95, 12.55]]

The two coordinate pairs are opposite corners of the rectangle the image should cover; the overlay renders semi-transparent so the base map shows through.

Image-based maps

Setting image: [[file.png]] replaces the world entirely: the map becomes the image, in its own pixel coordinate system, fully offline. This is the mode for floor plans, campus maps, board-game boards, and fantasy worlds — anything that deserves pan, zoom, and markers but has no latitude.

You write

```leaflet
image: [[Attachments/castle-plan.png]]
height: 420
marker: 640, 210, The keep
```

The image is resolved like any attachment wikilink, the map fits itself to the image when it loads, and markers and circle overlays work exactly as on a world map — their coordinates are read in the image's own units rather than degrees. An explicit bounds: [[0,0],[1000,1000]] substitutes a coordinate system of your choosing for the image's pixel dimensions, which keeps marker coordinates stable if you later re-export the image at a different resolution.

Photo maps

The photos: option is Clew's own. Point it at a vault folder and every geotagged photo in that folder becomes a pin, placed where the photo was taken — the GPS coordinates come straight from the photo's EXIF data. This fence is quoted verbatim from the demo vault's Features/Maps note:

You write

```leaflet
photos: [[Attachments/Holiday]]
height: 380
```

Each pin's popup shows a thumbnail of the photo, its capture day and time when the EXIF records one, and the photo's name as a link. Clicking the thumbnail opens the full image in a new tab; clicking the name opens — or creates — a note named after the photo. That second click is the point of the feature: a day of holiday photos becomes a day of annotated pins, each one a note you can write into, link from, and find again in search.

A photo map of Rome with an open popup showing a photo thumbnail, its name, and its capture time
A photo map of Rome (demo vault, Features/Maps). The open popup shows the photo's thumbnail, its name (a link that opens or creates a note about it), and the capture time read from the photo's EXIF data.

The mechanics, in order:

Caution The automatic HEIC-to-JPEG conversion uses the sips tool that ships with macOS, so it runs on Macs only. On Windows and Linux, unconverted HEIC photos are counted in the “without location” corner note; convert them to JPEG before adding them to the folder.
Tip Combine a photo map with the diary: a note for each day of a trip, each holding a photos: fence pointed at that day's folder. The map is the day's index — click a pin's name to start the note about that place, and the note is created on the spot.

Measuring distance

Every map carries a measuring tool: hold Shift and click two points, and the map draws a dashed line between them and reports the distance in the corner. Esc clears the current measurement, and another Shift-click starts a new one — though the previous line and readout currently remain on the map until the note re-renders. Two options tune the readout: unit: selects m, km, mi, or ft (kilometres by default), and scale: multiplies the measured distance before display — useful on image maps, where the underlying units are pixels and only you know how many leagues the kingdom map spans.

Framing and behaviour

A handful of options control how the map frames itself and how it responds to the user:

Maps on published sites

When you publish a vault with File → Export → Vault as Website, maps stay fully interactive on the exported pages: the Leaflet library ships with the site's assets, tiles stream from the same servers, and the pins — including gathered note markers and photo pins, with their thumbnails — are baked into each page at export time. See Publishing as a website.

Obsidian compatibility The fence syntax is compatible with the Obsidian Leaflet plugin where the two overlap — lat, long, zoom, marker: lines, image: maps, geojson, gpx, overlays, and the framing options all read the same — so a vault written for the plugin largely renders as-is, and keys Clew does not use (the plugin's id:, for instance) are ignored harmlessly. In plain Obsidian without the plugin, a ```leaflet fence displays as an ordinary code block: nothing breaks, the map is just not drawn. photos: is Clew-only.

Reference

The complete option surface of the ```leaflet fence. Options marked “repeatable” may appear on multiple lines. Boolean options accept true (or the bare key with no value).

OptionFormEffect
lat, longdecimal degreesMap centre. lng is an alias for long. Omit both to auto-fit around the markers.
zoomnumberInitial zoom level (default 5). defaultZoom is an alias.
minZoom, maxZoomnumberZoom range limits.
zoomDeltanumberZoom step per click/scroll.
height, widthnumber or CSS lengthMap size; bare numbers are pixels. Height defaults to 400px.
tiles / stylestyle nameNamed tile style: voyager (default), light, dark, satellite, terrain, osm.
tileServerURL templateCustom {z}/{x}/{y} tile source; overrides tiles.
tileOverlayURL template, repeatableSemi-transparent tile layer over the base map.
tileSubdomainslettersSubdomains for a {s} placeholder in the tile URL.
marker[type,] lat, long [, label/[[link]]], repeatableA pin. Colour types: red, orange, yellow, green, teal, blue, purple. Wikilink popups open the note.
markerFile[[Note]], repeatablePin one note via its location frontmatter.
markerFolderfolder, repeatablePin every note in a folder (recursive).
markerTag#tag, repeatablePin every note whose frontmatter tags include the tag.
geojsonfile, repeatableDraw a GeoJSON file's features; geojsonColor sets the colour.
gpxfile, repeatableDraw a GPX track with start/end/waypoint dots; gpxColor sets the track colour.
overlay[color,] lat, long, radius[m|km|mi|ft] [, label], repeatableTranslucent circle; overlayColor sets the default colour.
imageOverlay[[file]], [[lat,long],[lat,long]], repeatablePin an image over real coordinates.
image[[file]]Image-based map in the image's own coordinates; fully offline.
photosfolderPhoto map: a pin for every geotagged JPEG in the folder. Clew-only.
bounds[[lat,long],[lat,long]]Fit the view to a rectangle; on image maps, defines the coordinate system.
zoomFeaturesbooleanFrame the view around the GeoJSON/GPX geometry.
showAllMarkersbooleanFrame the view around every marker.
noScrollZoombooleanDisable wheel zoom.
noUIbooleanHide the zoom control.
lockbooleanDisable all pan/zoom interaction.
recenterbooleanGlide back to the configured centre after a pan.
unitm/km/mi/ftUnit for the Shift-click distance tool (default km).
scalenumberMultiplier applied to measured distances.
darkModebooleanAccepted for Obsidian Leaflet compatibility; Clew themes maps automatically.

See also