Your data's journey, in six steps
Everything happens inside your browser. Your files are never uploaded anywhere; closing the tab discards them.
1 · Bring your files
Drop everything at once onto the drop zone or the main area: your table, a background picture if you have one, and any audio, video, images or transcripts the table mentions. No picture? Press No background for a blank plot frame.
You do
- Drop a
.csv,.tsvor.jsontable. - Optionally drop a map or figure image.
- Optionally drop media files named in the table.
Maplew does
- Sorts files by their ending (see the table below).
- Reads the header row and decides what each column is for.
- Treats an image as the background unless a table cell names it.
Good to know
- Label columns with
loc::,dim::,med::,desc::for reliable results. - Write decimals with a point (
46.5), not a comma. - A status line under the drop zone lists what was found and what is missing.
2 · Pick X and Y (Location columns)
Two columns decide where each row sits. Maplew guesses them for you and you can change the guess.
You do
- Check the X and Y dropdowns.
- Tick Web Mercator only if the background is a screenshot of a web map (Google Maps, OpenStreetMap).
Maplew does
- Guesses in this order:
loc::columns, then names like lon/lat or x/y, then the first two numeric columns. - Counts rows whose coordinates are not numbers and tells you how many will be skipped.
Good to know
- X and Y need not be geography. Any two numeric columns make a scatter plot.
- Changing X or Y guesses the edge values again in the next step, unless you typed or loaded your own; those are kept.
3 · Calibrate
Calibration tells Maplew which data value sits where on the picture. Without it, points still appear but are only stretched to fill the frame.
You do, one of
- Image edges: type the data value at the left, right, top and bottom edge.
- Three-point: click three places on the picture and type their coordinates. Handles tilted or scanned maps.
- Pixels: nothing; the table already holds pixel positions.
Maplew does
- Prefills the edges from your data's range so something shows at once.
- Marks that prefill in yellow as approximate until you replace it.
- Redraws on every change.
Good to know
- With No background the prefill is all you need.
- You may never need to type anything: a saved CSV, a sidecar file or a setup file can carry the calibration.
- Edge values belong to the picture: load a new table onto the same map and they stay. On a blank frame they are guessed again.
4 · Style the points (Encodings)
Choose which columns drive colour, size and shape. The legend is built from those choices and doubles as a control panel.
You do
- Pick a column for Color, Size and Shape, or leave any at "none".
- For numeric columns choose continuous (a gradient) or categorical (one colour per value).
- Adjust sliders and toggles under Display.
Maplew does
- Proposes a first colour and shape column.
- Builds filter chips for every categorical choice.
- Mirrors the legend onto the map so it stays visible with the sidebar closed.
Good to know
- Click a legend entry to hide or show that category.
- Each legend row has its own colour, size or shape override.
- Shape has 8 symbols and only suits categories.
5 · Explore and edit
Hover a point for a summary. Click it for the full record with its media. Scroll to zoom and drag to pan.
You do
- Click: open the record.
- Shift+click: edit it.
- Alt+click a second point: compare side by side.
- Ctrl/Cmd+click: mark it.
- Under Edit positions: drag points or click the map to add one.
Maplew does
- Plays audio and video, shows images, embeds YouTube links.
- Shows ELAN and Praat transcripts in step with the audio.
- Records every move, edit, add and delete so you can undo it.
Good to know
- Zooming and panning never change your data.
- Spread stacked points separates rows that share one location, on screen only.
- Edits live in the browser until you save. Leaving the page asks first.
6 · Save and share
Three buttons, three different things. Most people want the first two together.
You do
- Save to CSV: your table, with edits and calibration.
- Export setup: the look of the plot, as a small JSON file.
- Snapshot PNG: a picture of the plot for a paper or slide.
Maplew does
- Adds one reserved row to the CSV holding the calibration.
- Writes column roles into the CSV headers as prefixes.
- Draws the snapshot at the background image's full resolution.
Good to know
- The background image and media are never inside the CSV or setup file. Send them alongside.
- Load a setup file with Import setup, not by dropping it on the drop zone.
- See what each save keeps.
Which file does what
Maplew decides by the file's ending, then by whether the table mentions the file's name.
| You drop | It becomes | How it is matched |
|---|---|---|
.csv .tsv | The table. One row is one point. | Comma, tab or semicolon separated; detected automatically. If you drop several, the one with loc:: columns wins. |
.json .jsonl .ndjson | The table. | A list of records, or one record per line. |
.png .jpg .gif .webp .svg | The background, or a picture shown in a record. | Background if no table cell contains its filename. Otherwise it belongs to the record that names it. |
name.png.calib.txt | Calibration for name.png. | Same filename as the image plus .calib.txt. Lines L: R: T: B:. |
.wav .mp3 .flac .ogg .m4a .mp4 .webm .mov | Audio or video in a record. | By filename, from a med:: column. Folders in the cell are ignored. |
.eaf .TextGrid | A transcript under the audio player. | Named in a media column, or same base name as the file in med::audio. |
Setup .json | The saved look of a plot. | Only through the Import setup button. |
A setup file dropped on the drop zone is read as a table, because both end in .json. Use Import setup for it.
Column labels
| Header starts with | Meaning | Where it shows up |
|---|---|---|
loc:: | A coordinate | X and Y dropdowns |
dim:: | Something to colour, size or shape by | Top of the encoding dropdowns, tooltip, record |
med:: | A media file name or link | Player in the record window |
desc:: | Longer text | Record window only |
res:: | Bookkeeping | Hidden everywhere, kept in the saved CSV |
| no prefix | Guessed from the name | Change it any time under Column roles |
What unlocks what
Sidebar sections appear as soon as they can do something. If a section is missing, the box to its left has not been satisfied yet.
Explore speaker (inside Encodings) appears only when a column is named speaker or speaker_id. Background map lists the background images you dropped; with more than one you can switch between them.
What each save keeps
| What you made | Save to CSV | Export setup | Snapshot PNG |
|---|---|---|---|
| Table values, including moved, added and edited points | Yes | No | As drawn |
| Column roles | Yes, as header prefixes | Yes | No |
| Calibration, X and Y columns, Mercator | Yes, in one reserved row | Yes | No |
| Colour, size and shape choices; filters | No | Yes | As drawn |
| Point size, opacity and other Display toggles, and whether the on-map legend is minimised | No | Yes | As drawn |
| Title and axis labels | No | Yes | Your choice |
| Background image | No | Only which basemap was active | Yes |
| Audio, video, record images | No | No | No |
| Zoom and pan position | No | No | No, always the whole image |
Two smaller saves: Change log (Edits section) downloads the list of edits you made, and Download ELAN / TextGrid (in a record) saves corrections typed into a transcript. Neither is included in the three above.
To hand a complete plot to someone else, send four things: the saved CSV, the setup JSON, the background image and the media files.
Where calibration comes from
Calibration can travel with your files in three ways. When more than one is present they are applied in this order, so the later one wins.
- Reserved CSV rowA row starting
__PLEWMAP_CALIB__, written by Save to CSV. Read when the table loads. - Sidecar file
image.png.calib.txtnext to a background. Sets the four edge values when that image is shown, and again each time you switch basemap. - Setup JSONApplied last, by Import setup or automatically on an example page.
- PrefillEdges guessed from your data's range plus 6%. Shown in yellow as approximate.
Anything you type afterwards overrides all of them. Reset to defaults returns to the prefill.
Under the hood
One HTML file, one global state object S, one redraw function renderAll(). Almost every control follows the same loop.
The loop: a control fires its handler → the handler writes to S (or leaves a value in the DOM) → the handler calls renderAll() → the SVG overlay, both legends, the filter chips and the sidebar's visible sections are rebuilt from S.
Select any box for what it does and which functions to read. Function names match the source; the source is grouped under banner comments with the same headings.
1 · Inputs
2 · Intake
3 · State S
4 · Redraw
5 · Outputs
What triggers what
Read a row as: this action calls this handler, which changes this part of the state, and then this much is redrawn.
| Action | Handler | State it changes | Redraw |
|---|---|---|---|
| Drop files | handleFiles → ingestCSV | Everything is reset, then headers, data, cols, basemaps, media, alignFiles | Full, several times |
| Change X, Y or Mercator | onLocChange | locX, locY, mercator, skipped | Full, twice |
| Type an edge value | edgeEdited → applyCalibration | calib.edges, calib.valid, calib.prefilled | Full |
| Place a three-point marker | click on #overlay | calib.pts, calib.affine | Full |
| Switch basemap | switchBasemap → activateBasemap | Saves edges on the old basemap; activeBasemapId, imgW, imgH; applies the new one's edges | Full, after the image loads |
| Pick Color, Size or Shape | onEncChange → syncEncControls | enc; prunes filters | Full |
| Tick a filter chip or click a legend entry | setFilter, toggleFilter | filters[col][value] | Full |
| Legend colour, size or shape override | setCatColor, setCatSize, setCatShape | enc.color.catColors, enc.size.catSizes, enc.shape.catShapes | Full |
| Move a Display slider or toggle | onDisplayChange | Nothing in S; the value stays in the control | Full |
| Scroll to zoom, or + and − | mapZoomBy | view | CSS transform; plus a full redraw on the next frame unless "Marker size follows map zoom" is on |
| Drag the map | initMapNavigation | view.tx, view.ty | CSS transform only |
| Click a point | onPointClick → openModal | compare.a | Full |
| Alt+click, Ctrl/Cmd+click | onPointClick | compare.b, marked | Full |
| Shift+click, then Save | openRecordEditor → saveRecordEditor | The row; undoStack, changeLog; then classifyColumns | Full, three times |
| Drag a point | startPointDrag | The row's X and Y while dragging; one undo entry on release | That element only while dragging; full on release |
| Click the map in add mode | click on #overlay → createBlankRow | Appends a row, opens the editor | Full |
| Undo, Redo, Reset all | undo, redo, resetAllChanges | data, both stacks; then classifyColumns | Full |
| Change a column's role | setColumnRole | roleOverrides; then classifyColumns and both sets of dropdowns | Full, three times |
| Save to CSV, Export setup, Snapshot PNG | downloadCSV, downloadVisualizationConfig, downloadSnapshot | Read only | None |
Things that are easy to miss
- Display settings are not in
S. Point size, opacity, outline, ring, graticule, jitter, drag and add modes are read from their checkboxes and sliders during each redraw.displaySnapshot()collects them for the setup export. - Column facts are cached.
classifyColumns()fillsS.cols[h] = { role, numeric, uniq }. Anything that changes a cell or a role must call it again, which every edit path does. - Legend categories are more than the data.
legendCategories(col)merges the column's unique values with any value that has a custom colour, size or shape, so an override survives when its last row is filtered or edited away. - Zoom is a CSS transform on
#mapZoomWrap. The SVG'sviewBoxis always the image's pixel size, so point coordinates are image pixels at every zoom level. - Two transforms, both invertible.
dataToPixel()draws;pixelToData()turns a drag or a click back into data values. Both pass Y throughprojY()/invProjY()when Mercator is on. - The Hugo site adds nothing to the app. Each layout reads
plew-map.htmland inserts one<script>after<body>that setswindow.PLEW_HUGO, and on example pageswindow.PLEW_EXAMPLE(the manifest URL) andwindow.PLEW_SETUP. The last lines of the app's script act on those.
How an example page loads
| Step | Where | What happens |
|---|---|---|
| 1 | content/examples/<name>.md | Front matter names a manifest and optionally a setup. |
| 2 | layouts/_default/example-map.html | Hugo inlines plew-map.html and sets PLEW_EXAMPLE and PLEW_SETUP. |
| 3 | loadRemoteExample | Fetches the manifest, then every file it lists, six at a time, and wraps each as a File in manifest order. |
| 4 | handleFiles | The same path as a manual drop. If no image arrived, useBlankFrame() supplies one. |
| 5 | loadRemoteSetup | Fetches the setup JSON and calls applyVisualizationConfig. |
The full reference (every state field, the call tree of each entry point, and an index of all functions) is the code map. Measured slow spots, reproducible bugs and streamlining ideas are in REVIEW-FINDINGS.md.