The plan format
Every plan is one JSON file. The format is open source under the MIT licence, so you can read your plans, change them and show them with your own code, without Areaform. In the playground, Export saves the plan you are working on as such a file.
A small plan
Section titled “A small plan”A café with one level, its front wall, an entrance in that wall and a counter:
{ "$schema": "https://areaform.app/schema/v1/document.json", "schemaVersion": 1, "id": "5b0c8a52-3f0e-4d7a-9a51-2c1e7f0d9b14", "name": "Café Linden", "languages": { "default": "en" }, "kind": "store", "units": "m", "grid": { "step": 0.5, "snap": true }, "levels": [ { "id": "ground", "name": "Ground floor", "ordinal": 0, "elevation": 0, "height": 3.2, "outline": { "outer": [ [0, 0], [12, 0], [12, 8], [0, 8] ] }, "wallNodes": [ { "id": "n1", "position": [0, 0] }, { "id": "n2", "position": [12, 0] } ], "walls": [{ "id": "front", "a": "n1", "b": "n2", "thickness": 0.3 }], "openings": [ { "id": "entrance", "kind": "entrance", "width": 1.8, "host": "wall", "wallId": "front", "offset": 6 } ], "zones": [ { "id": "counter", "shape": { "outer": [ [8, 5], [11, 5], [11, 7], [8, 7] ] }, "label": "Counter", "category": "counter", "data": { "openFrom": "08:00" } } ], "obstacles": [], "underlays": [] } ], "connections": []}What is in a plan
Section titled “What is in a plan”A plan describes one place, a Space: a shop, a café, a shopping centre, an office, an exhibition hall, a warehouse, a flat. Its kind picks the defaults the editor offers, such as the categories of zones.
| Property | What it holds |
|---|---|
levels |
Each storey, with its height, its outline (the footprint of its floor area) and everything on it. |
wallNodes, walls |
Walls run along their centre line between two nodes; walls that share a node are joined. |
openings |
Doors, entrances, passages and emergency exits, set in a wall or standing free. |
zones |
Named areas: booths, rooms, counters, desks. |
obstacles |
Columns, shafts and voids that nobody walks through. |
underlays |
Reference images, such as a scanned floor plan, drawn under a level. The file stores only their address, never the image. |
viewpoints |
Cameras saved on a level for the 3D view, in the order a camera tour flies through them. Optional. |
connections |
Stairs, elevators, escalators and ramps between levels, with a stop on each level they serve. |
Your own data goes in a zone’s data, such as an exhibitor’s id or a booking reference. Areaform keeps it and never reads it, so you can match zones with records in your own systems.
A zone can show another plan inside it with innerSpace, such as a shop’s own plan in a shopping centre’s unit: { "space": "sp_…" } names that plan, and the optional fit, { "x": 12, "y": 4, "rotation": 0 }, places it in this one, its point [0, 0] at [12, 4], turned by rotation radians counter-clockwise. Both plans are in metres, so nothing is scaled. Visitors tap the unit and choose See inside.
Measurements
Section titled “Measurements”- Lengths are in metres, whatever units the editor shows.
- Points are
[x, y]pairs on a plane local to the plan.ygrows up the plan, as on a map, not down as on a screen. - Angles are in radians, counter-clockwise from the
xaxis. A viewpoint’s are the exception: compass degrees, so you can write one by hand. Itsbearingis the direction the camera looks towards (0 north, 90 east), and itstiltgoes from 0, straight down, to under 90, level with the floor. - A shape lists its corners once, without repeating the first at the end. Outer edges run counter-clockwise, holes clockwise, as in GeoJSON.
Checking a file
Section titled “Checking a file”The format has a JSON Schema, at its permanent address:
https://areaform.app/schema/v1/document.json
Name it in the file’s $schema property, as the example does: code editors that understand $schema, VS Code among them, use it to complete and check the file as you type. Areaform ignores the property.
Any JSON Schema validator for draft 2020-12 can check a file, in any language. In JavaScript, with Ajv:
import { Ajv2020 } from 'ajv/dist/2020.js';
const schema = await (await fetch('https://areaform.app/schema/v1/document.json')).json();const validate = new Ajv2020().compile(schema);
// plan: the parsed JSON of your fileif (!validate(plan)) console.log(validate.errors);The schema checks the shape of a plan: which properties there are, and what kind of value each holds. Areaform also checks the rules between values when it opens a plan: ids are unique, every reference names something that exists, shapes do not cross themselves, a connection stops on at least two levels. A file that passes the schema can still fail those.
The npm package @areaform/core ships the same schema as @areaform/core/schema/v1/document.json, so you can check files offline.
From a file to your website
Section titled “From a file to your website”A plan file written by you, by your developer or by an AI becomes a published plan in three steps:
- Sign up and press Import a plan in your Spaces.
- Pick the
plan.json, with the images its Underlays name (thesrcof a tracing image, such asscan.png), or the folder they are in. It becomes a new Space and opens in the Editor. - Check it, press Publish, and paste the snippet into your site.
An element that breaks a rule is left out, and the import says which one and why; a file that is not a plan at all says what is wrong and where in the file, before anything is made. The Free plan publishes two Levels: a plan with more still comes in, so you can see all of it, and says so.
To have an AI write the plan, give it this page and the JSON Schema, and say what the place is: its rooms or booths and their sizes, the doors, the floors. Ask for one plan.json in metres with a label on every Zone.
GeoJSON for maps
Section titled “GeoJSON for maps”A plan can also be saved as GeoJSON, which map and GIS tools such as QGIS, Mapbox and geojson.io open. In the playground, the GeoJSON button next to Export saves it. The file is one FeatureCollection: each level’s outline, and its walls (with their thickness), openings (a line across their width), zones, obstacles, and the stops of stairs and lifts. Every feature says what it is in featureType, and which level it is on in levelId and ordinal, so a tool can show one storey at a time. A zone keeps its label, category and your data.
GeoJSON places things on Earth by longitude and latitude, so the file needs to know where the plan is. In the editor, Where is it? in the sidebar sets it: paste the latitude and longitude of the middle of your plan from a map, and say which way up on the plan faces. In the file, it is the plan’s geo: the latitude and longitude of its point [0, 0], and its bearing, the compass direction of up on the plan in degrees clockwise from north:
"geo": { "origin": { "lat": 52.2297, "lng": 21.0122 }, "bearing": 30 }A plan without geo is saved in metres on its own plane, with "coordinateSystem": "local" at the top of the file. Code can use that file as it is, but a map shows it near 0°, 0°, off the coast of Africa.
How the format changes
Section titled “How the format changes”schemaVersionis the format’s version. It goes up only for a change an older reader would misread: a renamed property, a new required one, a changed meaning.- New optional properties come without a new version. Read past properties you do not know, and keep them when you write the file back.
- Areaform opens files of every earlier version and upgrades them. It refuses a file from a newer version rather than lose what it does not understand.
- Each version has its own schema address.
v1stays where it is when av2comes.