Renders a geotechnical boring log from JSON as a standalone SVG. The same
module is used by the paste-and-preview page at
uclageo.com/boring-log-viewer (see Website) and by the
render API. The viewers in nextgenerationliquefaction.org and vspdb.org use
the API version to draw their boring logs.
User documentation, written for engineers rather than developers, is at
https://sjbrandenberg.github.io/boring-log-viewer/ (source in docs/).
Cite version 1.0.0 as: Sahin, A., and S. J. Brandenberg (2026). Boring Log Viewer (version 1.0.0). DesignSafe-CI. https://doi.org/10.17603/ds2-rnc6-7323
import { renderBoringLog, validateBoringLog } from 'boring-log-viewer';
const { valid, errors, warnings } = validateBoringLog(json);
const svg = renderBoringLog(json, { units: 'ft', width: 900 });src/render.js has no dependencies and no DOM or Node APIs, so it can be
imported directly in a browser. validateBoringLog uses Ajv and needs a bundler
for browser use.
The input format is defined in schema/boring-log.schema.json
(JSON Schema 2020-12). A minimal log:
{
"schema_version": "1.0",
"layers": [ { "top": 0, "bottom": 5, "description": "Brown silty SAND" } ]
}Full examples are in tests/fixtures/. Main points:
- Depths are measured down from the ground surface in
units.length(morft).units.unit_weightiskN/m3orpcf, andunits.diameterismm,cm,m,inorft. SI is the default. layers: one object per stratum,{ top, bottom, description, uscs, hatch }. The graphic log useshatchif given (use"none"to leave it blank), then a material or rock named in the description (see below), thenuscs, then a the USCS symbol inferred from the description and shown in the USCS column (e.g. "silty SAND" gives SM). A layer with none of these has no USCS symbol, so its graphic log is left blank (a "clayey SILT", for example, is not drawn as ML or MH). The USCS hatches follow the Caltrans Soil and Rock Logging, Classification, and Presentation Manual (2010) legend. Coarse dual symbols (GW-GM,SP-SM,SC-SM...) are drawn as one Caltrans-style tile: the coarse soil's grain with a lighter silt or clay overlay. Other pairs, such asCL-MLorSP-FILL, or a dual whose half has a custom pattern, split the column in half. A layer withoutuscsgets a symbol inferred from its description, shown in parentheses as "(CH)", only when the description determines it: a symbol written in the text ("(SP-SM)"), an ASTM D2487 group name ("fat CLAY", "silty SAND", "poorly graded SAND with silt"), CLAY or SILT with a plasticity descriptor, "silty clay" (CL-ML), SILT group names (ML), and organic SILT/CLAY with low (OL) or high (OH) plasticity. Mixed layers, ranges ("lean to fat"), bare SAND or GRAVEL, and "clayey SILT" get none. The rules are ininferUscs()insrc/classify.js; they were reviewed against 655 layer descriptions from the NGL database. A recordeduscsis checked too (checkUscs()insrc/classify.js). When it isn't a possible symbol (a dual such asGW-GP; the ASTM D2487 duals are listed inDUAL_NAMES, and borderline soils use "/", e.g.CL/CH), or when the description determines a different symbol (also from the text after a heading such as "GRAVEL AND SAND:"), both are shown: the recorded one, with ours below it in parentheses, e.g. "SP-SM" over "(SW)" for a "well graded SAND". A recorded symbol that includes ours counts as agreeing: a dual (SP-SM for "silty SAND" or "poorly graded SAND"), a dual written in the other order (ML-CL), or a borderline symbol (CL/CH for "lean CLAY"). The validator returns a warning for each, andinfer_uscs=falseturns it off. A value with at least one real group symbol, likeSM-G, is accepted the same way and drawn from its real symbols (SM); one with none (XX) is an error.- Built-in hatches besides USCS: 67 materials a layer can use through
hatch, e.g."hatch": "FILL"or"hatch": "SANDSTONE", also in dual patterns such asSP-FILL. Their names and groups are insrc/lithology.js; the artwork is drawn byscripts/lithology-art.js, with rock patterns after the FGDC Digital Cartographic Standard for Geologic Map Symbolization (FGDC-STD-013-2006, section 37) at a density that reads in a 40 px column (runnpm run build:hatchesafter changing it orscripts/uscs-art.js, andnode scripts/hatch-catalog.js catalog.png --allto see them all). A code without its own tile falls back along its chain, e.g. SANDSTONE to ROCK_SED to ROCK. They are also inferred from the description when it names the principal material (inferMaterial()insrc/materials.js, reviewed against 802 NGL layer descriptions): fill as the principal material, a leading label ("FILL: silty sand") or an origin tag ("(HYDRAULIC FILL)"); asphalt, concrete and base course; topsoil, shells, cobbles, wood, ash, pumice, loam; no recovery or core loss; and rock names ("SHALE, black, hard"; "rock, clay" is CLAYSTONE). A minor constituent ("with trace shells") never counts, and a soil named in capitals outranks a material that isn't ("coarse pumice SAND" is sand). Bentonite is drawn as CH. An inferred material wins overuscs(a fill layer is drawn as FILL, with its USCS symbol still in the USCS column);infer_materials=falseturns this off.- Fill and man-made:
FILL,FILL_HYD,FILL_ENG,FILL_UNDOC,DEBRIS,ASPHALT,CONCRETE,BASE_COURSE - Natural materials:
TOPSOIL,SHELL,COBBLES,WOOD,ASH,CEMENTED,LOESS,MARL,DIATOMITE,BENTONITE,LOAM,QUICK_CLAY - Non-material intervals:
WATER,NO_RECOVERY,VOID - Rock: category:
ROCK,ROCK_SED,ROCK_IGN,ROCK_MET - Rock: transitional:
WEATHERED,IGM - Rock: sedimentary (clastic):
SANDSTONE,SHALE,SILTSTONE,MUDSTONE,CLAYSTONE,CONGLOMERATE,BRECCIA - Rock: sedimentary (chemical/organic):
LIMESTONE,DOLOMITE,CHALK,CHERT,COAL,EVAPORITE - Rock: igneous (intrusive):
GRANITE,GRANODIORITE,DIORITE,GABBRO,PERIDOTITE - Rock: igneous (extrusive):
BASALT,ANDESITE,DACITE,RHYOLITE - Rock: igneous (pyroclastic):
TUFF,VOLC_BRECCIA,SCORIA,PUMICE - Rock: metamorphic (foliated):
SLATE,PHYLLITE,SCHIST,GNEISS - Rock: metamorphic (non-foliated):
QUARTZITE,MARBLE,HORNFELS,SERPENTINITE,GREENSTONE - Rock: fault rock:
FAULT_GOUGE,FAULT_BRECCIA,MYLONITE
- Fill and man-made:
samples:{ top, bottom, name, type, blow_count, blows, energy_ratio, sampler_diameter, recovery_percent, total_unit_weight, dry_unit_weight, remarks, specimens }. A sample's text is itsremarks(NGLSAMP_REM); adescriptionfrom older documents is accepted, with a warning, and shown at the start of the remarks. Lab results go on the sample's specimens (below).typepicks the symbol in the sample column, one of: drive samplersSPT,ModCal,DamesMoore; push samplersShelby,Piston,Osterberg,Pitcher,Denison,LargeDiameter,DirectPush,GelPush;Block; coresSonic,Core,TripleTube; disturbed samplesBulk,Grab,Composite,Auger,Trench,Disturbed; andOther(the default).NoRecoveryis also accepted, with a warning (see below). The list and legend names are insrc/samplers.js.recovery_percentis the recovery as a percent of the sample interval; it is shown as a note at the start of the sample's remarks, "Recovery 80%", or "No recovery" when it is 0 (an olderrecoverylength is converted to a percent, with a warning). No recovery is an outcome, not a sampler type: give the sampler that was tried astype. A sample whosetypeornameis "NoRecovery", "No recovery" or "NR" is read asrecovery_percent: 0(with a warning), drawn asOtheror its given type.specimens(in a sample): the specimens cut from the sample for laboratory tests. As in NGL, lab results belong to a specimen (SPEC:SPEC_REF,SPEC_TOP,SPEC_BASE,SPEC_REM), with its index tests (INDX) and Atterberg limits (PLAS), not to the sample:{ name, top, bottom, water_content, total_unit_weight, dry_unit_weight, specific_gravity, fines_content, liquid_limit, plastic_limit, nonplastic, uscs, remarks }(uscsis the lab classification, drawn in the Lab USCS column). A specimen withouttopgets no box (none is made up from the sample's depths) and its results are shown level with the sample; one withtopand nobottomis drawn at that depth. Each is drawn as a grey box over its depth range in the Specimen column (side by side when they overlap), with its name in Specimen no. and its results on a row level with it, so one sample can show several specimens' results. A specimen outside its sample gets a warning; abottomabove thetopis an error. Lab results given on the sample itself (water_content,liquid_limit..., as in older documents) are still accepted, with a warning, and shown the same way, without a box.total_unit_weightanddry_unit_weightmay be given for a whole sample (e.g. a tube weighed before extrusion), without a warning. AGS4 lab rows go on the specimen given bySPEC_REFandSPEC_DPTH; DIGGS results on theirspecimenRef(else one specimen per tested interval).groundwater: a list of{ depth, date, note }.depth_notes: a list of{ depth, description }for observations at one depth within a layer ("thin sand lens"). They are drawn in italics in the material description column, with a tick at their depth.references: a list of{ text, url }for the sources of the data (the report or paper the boring comes from), listed in the header, after the metadata, so they're seen before a tall log (below the legend when the header is turned off). An http(s)urlis shown after the text, unless the text already contains it, and is a link in SVG output; other values (e.g. "Personal communication") aren't linked.references=falseleaves them off.patterns: your own graphic log patterns and sampler symbols, by code:{ "FILL": { "name": "Fill", "svg": "<svg viewBox='0 0 40 20'><line x1='0' y1='20' x2='40' y2='0' stroke='black'/></svg>" } }. Each entry has eithersvg, SVG markup whose size comes from itsviewBox(orwidth/heightin px), orimage, a base64 data URI of a PNG, JPEG or SVG withwidthandheightgiving its pixel size (either at most 350,000 characters). SVG markup is parsed and rebuilt bysrc/svg-pattern.jsfrom an allowlist:path,rect,circle,ellipse,line,polyline,polygonandg, with geometry and fill/stroke attributes (style="..."is read into attributes). Titles, metadata and editor namespaces (Inkscape, Illustrator) are dropped; text, images,<use>,<style>, scripts,url(...)values and DOCTYPEs are rejected with a message. The rebuilt SVG is drawn as a data URI in an<image>, like a picture, so no user markup goes into the log itself. Add"kind": "sampler"for a sampler symbol (stretched to fill the sample's box), andtile_width(px on the log) to change how large a soil tile is drawn; by default one tile spans the graphic log column. A code equal to a USCS symbol (SM) or a built-in sampler (SPT) replaces the built-in pattern everywhere in the log. Any other code (letters, digits and_, up to 16 characters, starting with a letter) adds a new one: set a layer'shatch, or a sample'stype, to it. Custom codes also work in dual patterns such as"hatch": "SP-FILL". Images are embedded in the SVG, so logs stay self-contained. The web page's Hatches… button builds these entries from an image file: SVG files and raster images traced to vector shapes (with imagetracerjs, the default) are stored assvg; a raster kept as a picture (for photos or shading) is stored asimage, scaled down to 512 px. It setshatchortypeon the layers or samples the user ticks, so no JSON editing is needed. It also lists the built-in hatches and sampler symbols, each with a Replace button.layout: how the log is laid out, kept with the data. Without it the built-in layout is used."layout": { "width": 1000, "font_size": 10, "columns": [ "depth", { "id": "graphic", "width": 5 }, { "id": "description", "width": 25, "label": "Soil description" }, "sample_type", "sample_name", "blow_count", { "id": "pp", "source": "sample", "field": "pocket_pen", "label": "PP (tsf)", "width": 3 }, "specimen", "specimen_name", "water_content", { "id": "cu", "source": "specimen", "label": "cu (kPa)", "decimals": 0 }, { "id": "remarks", "width": 12 }, { "id": "notes", "source": "blank", "label": "Field notes", "width": 10 } ] }
columnslists the columns in order, each a column id or an object. Widths are relative: the columns share the log's width in proportion to them. A built-in column without a width gets its usual width in px / 10 (depth 3.8, graphic log 4, values about 3; description 30 and remarks 15).labelreplaces the heading. A new id with asourceadds a custom column:"sample"shows each sample'scustom[field],"specimen"each specimen's (on the specimen rows, like LL and PL),"blank"an empty column for notes by hand;fielddefaults to the id, anddecimalsrounds numbers (without it they are shown as given). The values go in the sample or specimen:"custom": { "pocket_pen": 1.5 }. Depth, graphic log and description are always drawn, empty columns are hidden as usual (not blank ones), and an unknown id without a source, a custom column with a built-in id, or an id listed twice is an error.widthandfont_sizeset the log's; render options given by the caller (the API's query, the page's settings) take precedence, except that the web page keeps a layout's width.defaultLayout(doc)returns the layout the log is drawn with now, with relative widths that reproduce it, andlayoutColumns(doc)lists every built-in column with its heading and default width. On the web page, nobody needs to write this by hand: the Layout… window lists the columns with a tick box, heading, relative width and up/down buttons, shows the widths as a bar, adds custom columns (with a box for each sample's or specimen's value) and writeslayoutand thecustomvalues as you go, so the preview follows. Use built-in layout removes it, and Undo changes goes back to how the log was when the window opened. Its logic is insite/layout-state.js.nullmeans "not given", so database exports can be passed through without cleaning. Unknown property names are errors, which catches typos.
| option | default | meaning |
|---|---|---|
width |
800 | SVG width in px. It widens if the text columns would go below 60 px per flex unit. |
height |
500 | Starting height of the log body in px |
scale |
– | px per display length unit; overrides height |
fit_text |
true | Stretch the depth scale so sample rows line up with their samplers (up to an 8,000 px body) and stacked descriptions fit within it |
units |
data's units | Display length units, m or ft; unit weight and diameter follow unless set below |
unit_weight, diameter_units |
– | Override display units |
columns |
the layout's, else DEFAULT_COLUMNS |
Column ids, in order (a layout's custom columns can be used) |
hide_empty_columns |
true | Drop columns with no data |
header, legend |
true | Metadata block above, legend below |
references |
true | The document's references, in the header (below the legend without one) |
title |
metadata.boring_name |
Title text |
depth_range |
[0, deepest] |
[top, bottom] in display units |
font_size |
10 | px |
infer_uscs |
true | For layers without uscs, show a USCS symbol inferred from the description, in parentheses (see below) |
infer_materials |
true | For layers without hatch, draw a material or rock hatch named in the description (fill, asphalt, topsoil, shale...), ahead of uscs |
id_prefix |
hash of the data | Prefix for <pattern> ids. Logs with different data get different ids, so several can share a page. |
Column ids: depth, elevation, groundwater, graphic, uscs,
description, sample_type, sample_name, sampler_diameter,
blow_count, energy_ratio, the specimen columns specimen (the boxes), specimen_name,
water_content, total_unit_weight, dry_unit_weight, specific_gravity,
fines_content, liquid_limit, plastic_limit, and remarks: one column
with every sample's remarks, level with the sample, and every specimen's,
level with the specimen.
Text is measured with a built-in table of character widths
(src/font-metrics.js). The table was built from Arimo, which has the same
widths as Arial and Liberation Sans, so line breaks come out the same in every
browser and on the server. The DOM is never used for measuring. The SVG asks for
Arial first, then those substitutes. When the server renders PNGs with resvg, it
must have Liberation Sans or Arimo installed, or be given the font file.
Descriptions start at the top of their layer. If the previous description ran long, the next one starts below it, and a leader line connects the layer boundary to the text. A layer's depth notes follow its description, each with its first line level with its depth when there is room, or pushed down with a leader from its depth when there isn't.
Each sample's row starts with its first line level with the middle of the
sample, and long text (e.g. a wrapped remark) extends below it. Specimen rows
are laid out the same way, on their own, each level with its specimen. With
fit_text, the depth scale first stretches until no row runs into the next,
so every row lines up with its sampler symbol, and then until all descriptions
end within the depth of the boring. The first stretch is capped at an 8,000 px
log body; past that, rows that would collide are pushed down instead.
The web page also opens Excel workbooks (.xlsx) laid out like
site/templates/boring-log-template.xlsx (served as
templates/boring-log-template.xlsx, with filled-in examples B-3-example.xlsx
and NAS-1.xlsx). One workbook is one boring; each sheet is one part of the
JSON (Units, Metadata, Layers, Samples, Specimens, Groundwater, Depth notes,
References, Layout, Columns). The template's instruction rows are optional:
header rows are found by their field names. The converter is src/xlsx.js
(xlsxToBoringLog(bytes) -> { document, warnings }, no dependencies; it
runs in the browser, not in the API). Its SHEETS list defines the sheets
and fields; after changing it, rebuild the templates with
python3 scripts/build-xlsx-template.py,
python3 scripts/build-xlsx-template.py examples/NAS-1.json and
python3 scripts/build-xlsx-template.py tests/fixtures/coastal-style.json site/templates/B-3-example.xlsx
(needs openpyxl), then the test fixtures as in tests/xlsx.test.js.
The paste page is in site/. npm run build bundles it, with the renderer and
validator, into public/, which is the folder Apache serves. The page runs
entirely in the browser:
- Paste JSON, open
.jsonfiles, drag them onto the editor, or load an example. - Several logs can be open at once, each in its own tab above the editor (‹ › step through them). Each opened file, example or borehole of an AGS4 or DIGGS file becomes a tab; + New starts an empty one. The open logs are kept in the browser between visits, and All logs (ZIP) downloads every one as SVG and PNG.
- Open an AGS4 (
.ags) or DIGGS (.xml) file: it is converted to JSON in the browser, one tab per borehole with strata (see AGS4 import and DIGGS import). - A map below the editor shows every open log that has
metadata.latitudeandlongitude, with a street (OpenStreetMap) or satellite (Esri) background; clicking a marker opens that log. It zooms to the logs within 50 km of the one being edited. The map tiles are the only thing the page loads from elsewhere. Leaflet draws the map and is bundled into the page. - Syntax and schema errors are listed with their location. Clicking one selects the offending text in the editor.
- The preview updates as you type.
- Download as SVG or PNG (1× to 4×), or print to PDF (the print style shows only the log).
- The open logs and option settings are kept in the browser's local storage.
Four examples are the synthetic test fixtures. The others are real borings
from one site in Nantou, Taiwan (examples/NAS-1.json to NAS-4.json, from the
PEER Taiwan Ground Failure Database via the NGL database), which open together
in four tabs. They show no-recovery samples and USCS symbols that
don't match their descriptions.
AGS4 files (the UK and international geotechnical data transfer format) can be
drawn directly: open one on the web page, or send it to the API (below). The
conversion is agsToBoringLogs() in src/ags.js, shared by both, and makes one
document per borehole (LOCA_ID):
| AGS4 group | becomes |
|---|---|
PROJ, LOCA, HDIA |
metadata: project, site (PROJ_LOC), ground level, dates, hole type (expanded with ABBR, e.g. CP = Cable percussion), driller (PROJ_CONT), latitude/longitude when given, remarks, hole diameter |
GEOL |
layers (GEOL_DESC); rows without a base are left out with a warning |
DETL |
depth notes |
SAMP |
samples; SAMP_TYPE B/LB = Bulk, BLK = Block, D = Disturbed, U/UT/TW = Shelby, P = Piston, SPT, C = Core, WS = DirectPush; other types (ES, W...) are drawn as Other with the code in the sample number ("3 ES"). A sample with only a top is drawn 0.15 m long (0.45 m for an SPT). SAMP_DESC and SAMP_REM together are its remarks |
ISPT |
SPT blow counts (ISPT_NVAL, or the main drive of a refusal such as "50/150mm"), blows per 150 mm from ISPT_INC1–6, energy ratio |
LNMC, LLPL, GRAG, LDEN, LPDN |
water content, liquid and plastic limits (NP = nonplastic), fines content, dry unit weight (from dry density), specific gravity; matched to their sample, on one specimen per SPEC_REF and SPEC_DPTH |
WSTG (and AGS3-style WSTK) |
groundwater: water strikes |
AGS depths are metres, so documents are in SI units. "MADE GROUND", the British
term for fill, is drawn with the fill hatch. Tested on the synthetic
tests/fixtures/example.ags and on 48 real boreholes exported from the BGS
National Geoscience Data Centre. AGS3 files are rejected with a message.
DIGGS XML files (versions 2.5, 2.6 and 3.x, https://diggsml.org) are read the
same way, by diggsToBoringLogs() in src/diggs.js, which has its own small
XML reader (no DTDs or external entities) so it runs in the browser too. One
document per Borehole (also TestPit, Trench; CPT soundings are skipped):
| DIGGS | becomes |
|---|---|
Project, Borehole |
metadata: project, name, latitude/longitude/elevation from referencePoint (x y z, i.e. longitude first), dates, construction method and rig, logger and drilling contractor from the roles, remarks |
| linear referencing | the document's length unit (ft or m), from each borehole's LinearReferencingMethod |
LithologyObservation |
layers: lithDescription, or one composed from consistency, color, major and minor constituents and moisture; USCS from classificationCode/legendCode. An observation at a single depth inside a stratum becomes a depth note ("@ 4.5'; reddish brown"); outside one it starts a stratum |
SamplingActivity |
samples: method codes such as SS/SPT, ST/SH (Shelby), core sizes, bulk; recovery length converted to a percent of the sample interval |
Test results |
SPT N-value and drive-set blows; water content, liquid and plastic limits, nonplastic, fines, dry density (as unit weight, pcf for logs in feet), specific gravity, USCS symbol. Matched to samples by sampleRef, else by depth |
WaterStrike |
groundwater |
Property names vary between files (n_value, "N-Value"), so results are
matched on their class and name. Tested on a synthetic
tests/fixtures/example.diggs.xml and the official DIGGS examples
(github.com/DIGGSml/diggs-examples): the Ohio DOT projects (13 borings), the
annotated DIGGS 3 borehole, and the Bolivian grading example.
server/ is a Fastify service (npm start, which listens on
127.0.0.1:3000). Apache forwards /boring-log-viewer/api/ to it.
| endpoint | returns |
|---|---|
POST /api/render |
The log as SVG (default), PNG or HTML. The body is the boring log JSON, an AGS4 file sent as text/plain, or a DIGGS file sent as application/xml (?loca_id= picks the borehole; required when the file has several). |
POST /api/ags |
An AGS4 file (text/plain) converted to { documents: [{ loca_id, document }], warnings } |
POST /api/diggs |
A DIGGS file (application/xml) converted the same way |
POST /api/validate |
{ valid, errors, warnings } |
GET /api/schema |
The JSON Schema |
GET /api/health |
{ status, version, endpoints } |
curl -X POST -H "Content-Type: application/json" --data-binary @boring.json "https://uclageo.com/boring-log-viewer/api/render?format=png&units=ft" -o boring.png
curl -X POST -H "Content-Type: text/plain" --data-binary @site.ags "https://uclageo.com/boring-log-viewer/api/render?loca_id=BH01&format=png" -o BH01.png- Format:
?format=svg|png|html. Without it, theAcceptheader decides (with q-values). An unknown format gets 406. - Query parameters: the render options (
units,width,height,scale,font_size,columnsas a comma list,header,legend,references,fit_text,hide_empty_columns,title,id_prefix,unit_weight,diameter_units), pluspng_scale(0.5–4, default 2) anddownload=true, which setsContent-Disposition: attachment. Unknown or invalid parameters get 400, so a typo is reported instead of ignored. - Errors use one shape,
{ error, errors: [{ path, message }] }:- 400: malformed JSON (with the parser's position) or a bad query parameter.
- 415: a body that isn't
application/json(ortext/plainfor AGS4,application/xmlfor DIGGS). - 422 for AGS4 and DIGGS: not AGS4 (e.g. AGS3) or malformed XML, no
LOCAgroup orBorehole, no borehole chosen from several, or a borehole with no strata. - 413: a JSON body over 1 MB, or an AGS4/DIGGS file over 10 MB.
- 422: an invalid log, more than 2,000 layers or 5,000 samples, or a PNG over 40 megapixels.
- 429: over the rate limit (60 requests per minute per client by default).
- Warnings such as layer gaps don't block rendering. They are returned in
the
X-Boring-Log-Warningsheader. - CORS is open (
Access-Control-Allow-Origin: *), since the API takes no credentials. Request bodies are not stored or logged. - PNGs are drawn with resvg using the bundled Arimo font (
server/fonts.js), never the server's own fonts, so the text matches the measured layout.
Deployment (Rocky Linux 9, Apache, systemd) is described in
deploy/README.md.
npm install
npm test # unit tests + snapshot comparison + resvg parse check
npm run dev # build the site, rebuild on change, serve at http://localhost:8080/
npm start # run the render API on http://127.0.0.1:3000/
npm run build # production build into public/
npm run test:update # re-render tests/snapshots/*.svg after an intended layout change
npm run render -- tests/fixtures/coastal-style.json out.png [--units=ft] [--width=900]
npm run build:hatches # regenerate src/hatches.js from scripts/uscs-art.js and lithology-art.js
npm run build:metrics # regenerate src/font-metrics.js (only if changing the font)
npm run docs:serve # build the documentation site into _site/ and serve it at http://localhost:8081/The documentation pages are HTML fragments in docs/pages/, wrapped in
docs/_layout.html by scripts/build-docs.js, which also renders the example
logs and the symbol galleries with the current code (see the comment at the top
of that script). Pushing to main publishes them to GitHub Pages through
.github/workflows/docs.yml.
After changing the layout, render the fixtures to PNG and look at them before
running test:update. The snapshot test only shows that the output changed, not
that the new output is right.
The fixtures are synthetic. They follow the shape of coastal_database and vspdb records, but they aren't real borings. Before switching either app to this renderer, replace them with exports of real borings.