Skip to main content

sitecontext

3D site context for any building model, from an address and open public data.

Give it an address. It downloads the roads and buildings around it from OpenStreetMap, the parcels from the county, and the terrain from USGS, then builds a 3D context model as glTF. If you have a building model, it fits the model onto its lot from the property lines, so the context lands in your model's own coordinates. It can also place the model in Google Earth Pro at the right position, height and heading.

Pacific Palisades, 250 m around the public library: standing buildings in white, buildings destroyed in the January 2025 fire (as mapped in OpenStreetMap) in orange, on USGS terrain

250 m around the Palisades Branch Library, Los Angeles. White: standing buildings. Orange: buildings destroyed in the January 2025 Palisades fire, as tagged in OpenStreetMap. Built in about a second from open data, rendered with the included Blender script.

Why

Every architecture, engineering or construction project starts with "what is around the site?" The usual answer is a paid data service, a day of hand modelling, or a screenshot from Google Maps. For most early design, coordination and client work you need something simpler: the street, the neighbours, the slope and the lot, in the same coordinates as your model. That is what this tool builds.

What you get

Output What it is
context.glb Terrain (USGS 3DEP), roads and paths at their real widths, draped on a smoothed profile, OSM buildings at their tagged heights, destroyed buildings as bare pads. Every mesh is named and carries its address, parcel, height and source. Opens in Blender, Rhino, three.js, Unreal, Unity, Windows 3D Viewer and anything else that imports glTF.
check.png Top-down plot of the context, every parcel, your lot and your property lines, for checking the registration.
site.kmz Your model (and optionally the context) placed in Google Earth Pro at the correct latitude, longitude, altitude and heading.
context.json Counts, the datum, and the offset between OSM and the parcels.

Install

pip install "sitecontext[all]"

Python 3.10+. The core needs only numpy and shapely. The extras add scipy (lot fitting), pillow (terrain) and matplotlib (check plot).

Quick start

sitecontext init palisades --address "861 Alma Real Dr, Pacific Palisades, CA 90272" --radius 250 --parcels la-county
sitecontext fetch palisades      # OSM, parcels, terrain, geoid heights  (~1 min, cached)
sitecontext build palisades      # -> palisades/context.glb
sitecontext check palisades      # -> palisades/check.png

That gives you the context in local east/north metres, with z = 0 at the ground at the address. To put it in your model's coordinates, register the model.

Registering your model

The context is most useful in your model's own coordinate system. There are two ways to tie the two together.

Fit to the lot (recommended). Read the property lines off your site plan, in model coordinates, and give the lot's parcel number:

{
  "parcels": {"source": "la-county", "lot_id": "<the lot's parcel number>"},
  "model": {
    "units": "ft",
    "property_lines": [[[0, 0], [62.5, 0]], [[62.5, 0], [64.1, 141.2]], [[0, 0], [-1.8, 139.7]]],
    "z0_elevation": 652.0
  }
}
sitecontext fit mysite
# prints the bearing of model +Y, the anchor, and the median / max distance of each line from the parcel

The fit is rigid (rotation and translation, no scale). A coarse search runs over every bearing, followed by a robust ICP against the exact parcel boundary, so one misread line does not pull the result off. Read the residuals. A line more than about 0.3 m off the parcel is usually a fence or setback line read as the property line, or the wrong parcel. Fix the input rather than accepting the fit. Use lines you are sure of: the front and both sides are enough. Don't trust the sheet's north arrow; it is often several degrees off, which is why the fit uses the parcel.

By hand. If you know the bearing of your model's +Y axis and where one point is:

sitecontext register mysite --bearing 23.4 --anchor 0,0 --at 34.04431,-118.52487

After registering, build writes the context in model coordinates (metres, z up, z = 0 at model.z0_elevation). Import it at the origin and it sits around your building.

Other options in site.json

Key Meaning
model.cutout Polygons (model units) where the context is cut out: your modelled site, so terrain never pokes through it. A ground skirt is added down the cut edge. build --cut-lot cuts out the whole lot.
model.street {"osm_name": "Alma Real Drive", "centerline": [[x, y], ...]}. Shifts OSM roads onto your model's street. OSM is traced from imagery and is often a few metres off the parcels. earth reuses this offset to line the model up with the aerial photo.
context.default_building_height_m Height for OSM buildings without height or building:levels (default 6 m).
terrain "flat" outside the US, or when you don't want terrain.
parcels.url, id_field, address_fields Any county's ArcGIS parcel layer, instead of a preset.

Google Earth

sitecontext earth mysite --model my_house.glb --name "My house"

Export the model as a .glb in the same frame you registered (metres). Open the KMZ in Google Earth Pro and untick Layers > 3D Buildings: Google's photo mesh shows what stands on the site today. A few details are handled for you:

  • Height. USGS terrain is in NAVD88, while Google Earth's absolute altitude is EGM96 sea level. The difference (about 0.4 m in Los Angeles) is looked up for the site from NOAA GEOID18 and EGM96.
  • Heading. The KML model heading is set to the bearing of model +Y.
  • Transparency. Earth Pro reads COLLADA transparency inverted, so opaque materials are written without it.
  • Mesh size. Large meshes are split at 60k vertices.

Google Earth on the web does not show KML 3D models; use Earth Pro.

Other counties

Parcels come from any ArcGIS REST layer; most US counties publish one. Find the county's parcel map service, then:

"parcels": {"url": "https://.../MapServer/0/query", "id_field": "APN", "address_fields": ["SITUS_ADDR"], "lot_id": "..."}

Pull requests adding verified presets are welcome (see CONTRIBUTING). Without parcels everything except fit still works.

Limitations

  • Terrain comes from USGS 3DEP, so the United States only. Elsewhere use "terrain": "flat"; a global DEM source is on the roadmap.
  • Neighbouring buildings are flat-roofed footprint prisms. They are only as good as OpenStreetMap, and footprints may predate recent rebuilds.
  • Trees, walls and driveways are not modelled.
  • Equirectangular local frame: accurate over the ~1 km a site context covers, not for city-scale areas.

Data and attribution

Everything is downloaded from public services. Only the address or coordinates are sent, never project or owner names. When you share outputs, credit the sources:

Roadmap

  • Global terrain (Copernicus GLO-30)
  • IFC input for earth and an IFC context export
  • Roof shapes from OSM roof:* tags, and trees from OSM
  • More verified county parcel presets

Contributing

Issues and pull requests are welcome; see CONTRIBUTING.md. If you use sitecontext on a real project, I'd like to hear how it went.

License

MIT © Sumanth Reddy Challaram

Metadata

Release files for sitecontext 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sitecontext 0.1.0
File Size Uploaded Provenance Actions
sitecontext-0.1.0.tar.gz 44.1 kB Without provenance Details for sitecontext-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sitecontext 0.1.0
File Interpreter ABI Platform Actions
sitecontext-0.1.0-py3-none-any.whl Python 3 none any Details for sitecontext-0.1.0-py3-none-any.whl

Total release size: 84.4 kB

Release files / sitecontext-0.1.0.tar.gz

Download URL sitecontext-0.1.0.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5be1064892474d91bf1f1d552a74dd3f9cd0cc9e726c95574977d82857f2c669
BLAKE2b-256 checksum
How to use checksums
2b7d7ac8fd34b8dd00444e7a17bddda4668a16ab20f3f5ebc9baf877493d2f74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / sitecontext-0.1.0-py3-none-any.whl

Download URL sitecontext-0.1.0-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e9b549c2623b4cbe5783a4b638fbc2040ca84aeff6b04ed1f0c29807f168944
BLAKE2b-256 checksum
How to use checksums
194bc8a9a885043c58a20c88c844cadcabce08b8e87f8f0e1c756edd1b9521ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for sitecontext 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page