Georeferenced Blender Scene

Vladimir Elistratov edited this page Mar 7, 2017 · 6 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 blender-osm/util/transverse_mercator.py or here 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)