Skip to content

Georeferenced Blender Scene

vvoovv edited this page Jul 13, 2023 · 7 revisions

A Blender scene is called georeferenced if it has custom properties lat and lon and optionally heading (rotation angle).

The lat and lon correspond to the the origin of the Blender global coordinate system.

Python module transverse_mercator.py located in blosm/util/transverse_mercator.py can be used to perform conversions between geographical coordinates and coordinates x and y in the Blender global coordinate system:

from transverse_mercator import TransverseMercator

scene = bpy.context.scene
projection = TransverseMercator(lat=scene["lat"], lon=scene["lon"])

# converting from the Blender global coordinate system to the geographical coordinates:
(lat, lon) = projection.toGeographic(x, y)

# converting from the geographical coordinates to the Blender global coordinate system:
(x, y) = projection.fromGeographic(lat, lon)