---
title: Get the footprint
summary: Get the outline of a model on the ground with BQL — the projection, its smallest rectangle or a slice at a height — as GeoJSON or WKT in WGS84, placed by the version's geo reference, and draw it on a map.
order: 25
languages: [javascript, java]
terms: [geo-reference, anchor-point, wkt, version, vid, scope]
see-also: [how-to/geo/get-the-geo-reference, how-to/geo/set-the-geo-reference, how-to/query/run-a-bql-query, reference/bql, explanation/geo-referencing-in-ifc]
---

# Get the footprint

The footprint is the outline of a model seen from above, placed on the earth: a polygon in WGS84 that a map, a GIS or a permit check can use as it is. You ask for it with a BQL query: `PROJECTION()` projects the building onto the ground and merges everything into one shape, holes included, and `.geojson("EPSG:4326")` or `.wkt("EPSG:4326")` places it with the model's [[term:geo-reference]], in *longitude latitude* order.

## Live demo

```demo
name: footprint
title: A model's footprint on a map
models: schependomlaan
height: 520
needs: Uses the two georeferenced demo models in your Demo folder; **Model** switches between them. Open BIM.works and sign in once in this browser.
notes: |
  The outline is drawn where the model's geo reference puts it, with the centre of the model's bounds as the red dot; the model set draws one outline per model. **Outline** switches between the projection, its smallest rectangle and a slice whose height you set. The panel shows the query and the answer.
```

## Before you start

- A client whose credential has the `query:run` [[term:scope]], and read rights on the version ([[page:how-to/query/run-a-bql-query]]).
- The [[term:vid|Vid]] of a processed IFC version with a geo reference: [[page:how-to/geo/get-the-geo-reference]] tells you whether it has one, and [[page:how-to/geo/set-the-geo-reference]] stores one. Without one, ask for `.geojson` or `.wkt` without a coordinate system: the outline in metres in the model's own coordinates.

## 1. Get it

```code-group {#get}
```javascript
const records = await client.bim.query([BIM_WORKS_FIRST_MODEL],
	'GET PROJECTION().geojson("EPSG:4326") AS footprint, PROJECTION().area AS outlineArea');
// By alias: records.columns says where each value is in a record
const {footprint, outlineArea} = QueryColumns.byLabel(records)[0];
console.log(footprint.type, outlineArea.value);    // "Polygon" 142.7
```
```java
import java.util.UUID;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

// Without AS: a shape's value is keyed by its text
ArrayNode records = client.bim.query("GET PROJECTION().wkt(\"EPSG:4326\"), PROJECTION().area",
		UUID.fromString(BIM_WORKS_FIRST_MODEL));
String wkt = records.get(0).get("PROJECTION().wkt(\"EPSG:4326\")").asText();    // "POLYGON ((2.2946846 48.8582237, ...))"
double area = records.get(0).get("PROJECTION().area").get("value").asDouble();
```
```

The answer is one record per version, with a field per shape you asked for, keyed by the shape's text. An `AS` names the shape's column in the answer's [[page:reference/bql/output#columns|columns]] (a keyword such as `area` cannot be a name), which is how `QueryColumns` finds it by that name:

| Member | What |
|---|---|
| `.geojson("EPSG:4326")` | A GeoJSON geometry (RFC 7946): a `Polygon` or a `MultiPolygon`, `[longitude, latitude]`. Another EPSG code gives that system's coordinates; no code, metres in the model's own coordinates. |
| `.wkt("EPSG:4326")` | The same as WKT, longitude first. |
| `.area`, `.perimeter` | In m² and m, holes subtracted and counted. |
| `.parts`, `.holes` | How many separate polygons and holes the outline has. |
| `.length`, `.width` | The long and the short side of the smallest rectangle around it. |

A query without a `WHERE` outlines the building envelope: walls, columns, slabs, roofs, footings and the other envelope and structure elements, with external spaces such as terraces left out. With a `WHERE` it outlines the objects you name, `WHERE type IN (IFCWALL, IFCSLAB)` for example. A version without a geo reference answers `null` for a member with a coordinate system.

## 2. Choose the outline

| Shape | What you get |
|---|---|
| `PROJECTION()` | Everything projected on the ground and merged: roofs and balconies that overhang the walls count. |
| `PROJECTION(ABOVE 0 mm)` | The same without what lies below the site level, such as wide footings. |
| `PROJECTION(MINIMUM_RECTANGLE)` | The smallest rotated rectangle around the projection. |
| `SLICE(1200 mm)` | A horizontal cut 1.2 m above the site level. |

```javascript {#types}
const records = await client.bim.query([versionUuid],
	'GET PROJECTION(MINIMUM_RECTANGLE).geojson("EPSG:4326") AS rectangle, SLICE(1200 mm).wkt("EPSG:4326") AS slice, SLICE(1200 mm).area AS sliceArea');
```

Heights are measured from the `IfcSite` placement; `FROM ABSOLUTE` measures from the model's z = 0 and `FROM LOWEST` from the lowest point of the objects: `SLICE(1000 mm, FROM LOWEST)`. `FILL_HOLES` keeps only the exterior rings, the outline of the building rather than its plan, and `FILL_HOLES 2 m2` fills only the holes smaller than 2 m². [[page:reference/bql]] has the rest of the language.

```example
name: get-a-footprint
code: javascript/get-a-footprint.js
run: none
notes: The projection, its rectangle and a slice in one query, and the points to mark on a map.
```

## 3. Mark the model on the map

[[page:how-to/geo/get-the-geo-reference|getGeoReference]] answers two points to mark next to the outline when you pass `placedPoints`: `bounds_centre`, the centre of the model's bounds, and `zero_point`, the model's origin, both `{latitude, longitude, elevation}` placed as the outline is. Neither is the version's [[term:anchor-point|anchor point]]: that one lies exactly on the geo reference's `latitude` and `longitude`.

```javascript {#points}
const placed = await client.gis.getGeoReference(versionUuid, null, {placedPoints: true});
console.log(placed.bounds_centre, placed.zero_point);
```

## 4. Draw it on a map

The GeoJSON goes onto a map as it is. This example draws the outline with MapLibre GL, the map library the BIM.works map view uses; Leaflet (`L.geoJSON`) and OpenLayers read the same geometry.

```example
name: footprint-on-a-map
code: javascript/footprint-on-a-map.js
notes: Needs `maplibre-gl` from npm and a `<div id="map">` with a height. The OpenFreeMap style needs no key; any MapLibre style will do.
```

## Moving from GetFootprint

| `getFootprint` | BQL |
|---|---|
| `getFootprint([vid])`, `wkt` | `GET PROJECTION().wkt("EPSG:4326")` (now with holes) |
| `geojson` | `.geojson("EPSG:4326")` |
| type `MINIMUM_BOUNDING_RECTANGLE` | `PROJECTION(MINIMUM_RECTANGLE)` |
| type `SLICE`, `{height_mm: 1200}` | `SLICE(1200 mm)` |
| slice `reference: LOWEST` / `ABSOLUTE` | `SLICE(1200 mm, FROM LOWEST)` / `FROM ABSOLUTE` |
| slice `tolerance_mm: 10` | `SLICE(1200 mm, TOLERANCE 10 mm)` |
| slice `fill_holes` (on by default) | `FILL_HOLES` (off by default) |
| slice `selection: ENVELOPE` / `ALL` | no `WHERE` / a `WHERE` that names the objects |
| `area_m2`, `cut_mm` | `.area`; the bare `SLICE(1200 mm)` answers the measures and the cut |
| `anchor_point`, `zero_point` | `getGeoReference(vid, null, {placedPoints: true})`: `bounds_centre`, `zero_point` |
| a `geo_reference` of your own | none: store the geo reference first, or take the outline in model coordinates |

The query needs the `query:run` scope where `getFootprint` needed `geometry:read`.

## In the app

With [[feature:EXPORT_WKT]], the export menu of a model copies the projection, a slice at the site level or a slice at 300 mm to the clipboard as WKT: in WGS84 when the model has a geo reference, else in metres in its own coordinates.

## Check

The outline lies where the model sits in the 3D viewer's geo mode, turned the same way, with `bounds_centre` in the middle of it (just outside it in the bend of an L-shaped building). If it is in the wrong place, the geo reference is: compare it with [[page:how-to/geo/get-the-geo-reference]].
