Your own hatches
Use your office's symbols, add a material the viewer doesn't have, or replace a sampler symbol, from an image file or by hand.
Your own symbols are kept inside the boring log's JSON, in a section called patterns. Because they travel with the data, a log that uses them looks the same wherever it's drawn: on the web page, through the API, or on another computer. Nothing is stored on the server.
With the Hatches… window (no JSON editing)
On the viewer page, click Hatches… above the text box.
- What is it? Choose whether it's for a layer (a hatch) or a sample (a sampler symbol). Give it a short code (letters, digits and
_, starting with a letter, up to 16 characters, e.g.FILL_CALTRANS) and the legend label to show beside it. - Choose the image. A PNG, JPG or SVG file of one repeat of the pattern. A raster image (PNG or JPG) is converted to vector shapes by default, which works best for black-and-white line patterns: check the preview, because fine dots or shading can be lost. Untick Convert to vector to keep a photo, scan or shaded image as a picture instead (it's scaled down to 512 px). Set the tile width to change how large one repeat is drawn; by default it spans the graphic log column.
- Choose the layers (or samples) that use it. Tick them in the list. The window sets their
hatch(ortype) for you.
Click Add to log. The log redraws with your symbol, and it appears in the legend.
Replacing a built-in symbol
The bottom of the window lists the built-in soil hatches, materials and sampler symbols. Click Replace beside one to put your own image in its place everywhere in this log. For example, replacing SM changes every silty sand layer, and replacing SPT changes every SPT symbol, without touching the layers or samples. Use beside a built-in material applies it to the layers you tick, with no image needed.
Using the same hatches in another log
Click Format, then copy the "patterns": { ... } section from the end of the JSON into the other log. To keep a set of office hatches, save that section in a text file. For use with scripts, see Using your own hatches with the API.
Writing a hatch by hand
A simple hatch can be written directly as SVG markup. This one draws a sloping line in a tile 40 px wide and 20 px high (the size comes from the viewBox):
"patterns": {
"SLOPE": {
"name": "Sloping lines",
"svg": "<svg viewBox='0 0 40 20'><line x1='0' y1='20' x2='40' y2='0' stroke='black' stroke-width='1.5'/></svg>"
}
},
"layers": [
{ "top": 0, "bottom": 3, "description": "Sloping lines layer", "hatch": "SLOPE" }
]
Use single quotes inside the SVG so you don't have to escape them in JSON. The tile is repeated across and down the layer, so make sure its edges join up.
Pattern fields
| Field | Meaning |
|---|---|
svg | SVG markup for one tile. Its size comes from its viewBox (or width/height in px). |
image | Instead of svg: a picture as a base64 data URI (data:image/png;base64,..., also JPEG or SVG), with width and height in px. |
width, height | The image's size in px (required with image; sets the tile's proportions). |
name | Legend label. Defaults to the built-in name, or the code. |
kind | "soil" (default) for a hatch, tiled over the layer; "sampler" for a sampler symbol, stretched over the sample's interval. |
tile_width | Width of one tile on the log, in px (4 to 400). Defaults to the graphic log column's width. |
Up to 30 patterns per log, each up to 350,000 characters.
How codes work
- A code that's the same as a USCS symbol (
SM) or a built-in sampler (SPT) replaces the built-in one everywhere in the log. - Any other code adds a new symbol. Use it by setting a layer's
hatch(or a sample'stype) to the code. - Your codes can be paired like built-in ones:
"hatch": "SP-SLOPE". - Using a code that isn't defined anywhere is an error naming the layer and the code.
Sampler symbols
Add "kind": "sampler". The symbol is stretched to fill the sample's box, so draw it at the proportions of a typical sample.
"patterns": {
"HandAuger": {
"name": "Hand auger",
"kind": "sampler",
"svg": "<svg viewBox='0 0 16 24'><rect x='1' y='1' width='14' height='22' fill='none' stroke='black'/><circle cx='8' cy='12' r='4'/></svg>"
}
},
"samples": [
{ "top": 1, "bottom": 1.5, "name": "HA-1", "type": "HandAuger" }
]
What SVG is allowed
For safety, the SVG is taken apart and rebuilt from a short list of drawing elements: path, rect, circle, ellipse, line, polyline, polygon and g, with their shape, fill and stroke attributes (a style="..." attribute is read too). Titles, metadata and the extra information Inkscape and Illustrator add are dropped quietly. Text, embedded images, <use>, <style>, scripts and links are rejected with a message saying what to change. In Inkscape, Path → Object to Path and saving as Plain SVG usually gives a file that works.