Open nc3d opened 1 year ago
Hi @nc3d
Coordinates in Google 3D Tiles are in meters with the origin at the center of the planet Earth. That means millions of meters for each axes. The addon performs some geometrical transformation to bring the 3D Tiles for the requested area to the center of Blender's system of origin.
If we knew the translation applied to the WGS coordinates then we could accurately reproject the data into a known coordinate system. Our projects are typically in a planar state plane coordinate system that we translate (move) so that the origin (0,0) is close to the center of the model to reduce rounding errors. Because the model is tied to a known coordinate system, we can import and combine data from GIS systems and civil engineering. I assume that the Google 3D tiles are based on WGS 84 because that's what Google's Java API uses. If we also knew the translation from WGS for each import, we could move or reproject the Blosm data to mesh with other data.
Is there a way to find the translation that Blosm applies to the imported data?
Thanks very much!
-Donald
The transformations are performed in the module blosm/release/threed_tiles/blender.py starting from the line 34.
The goal is to bring the area of interest to the center of origin with the center of the area of interest point strictly upwards (along Z-axis).
For that we apply the rotations: 1) around Z-axis, 2) around X-axis.
That brings the area of interest to the north pole.
Then we move the area of interest downwards to the origin.
@nc3d , did you ever figure this out? I'm also a Global Mapper user and I think I'm trying to do the same things you mention above. I have been trying for a while to understand how BLOSM reprojects things so I can bring in my own elements and create things at scale. I've tried using WGS, UTM, and State Plane but can't get the conversions to work out. My 1km x 1km test plane doesn't even seem to come in at the correct size/scale.
I don't think the code transforms the data to any known coordinate system. The python code could be modified to use the pyproj library to reproject the data to a state plane coordinate system with a transform value to move the origin to the center of the model. I might give this a try someday if I get another project where we'd need a lot of Google 3D tiles to accurately line up with our design and GIS data.
Based on the documentation I've had success with the following approach: https://github.com/vvoovv/blosm/wiki/Georeferenced-Blender-Scene
Computing the latitude / longitude of a selected object:
transverse_mercator_latitude = bpy.context.scene.get("lat")
transverse_mercator_longitude = bpy.context.scene.get("lon")
target_object = bpy.context.object
transformer = pyproj.Transformer.from_crs(
pyproj.CRS.from_proj4(
f"+proj=tmerc +lat_0={transverse_mercator_latitude} +lon_0={transverse_mercator_longitude}"
),
pyproj.CRS.from_epsg(4326),
)
latitude_degrees, longitude_degrees = transformer.transform(
target_object.matrix_world.translation[0],
target_object.matrix_world.translation[1],
)
@pveierland
How did you install pyproj in Blender's Python?
I'm using a development shell via Nix that sets up my Python environment, then I just run Blender within that environment with a PYTHONPATH
that includes the pyproj
and other needed packages.
@nc3d - It's not using a known GCS but the data from different sources (terrain, imagery, 3d buildings) lines up in Blender so there has to be a pseudo-projection there, even if it's not a standard GCS.
I created a 1km x 1km square as a test area to try and reproduce the conversion from lat/long to BLOSM Projection and created a 'grid' using the GPX importer, looks like things mostly line up (within a meter or two):
@vvoovv - In which .py file is the GPX file converted to the Blender curve? I'm still trying to understand/replicate the conversion process. Are any attributes/properties from the calculation stored anywhere in the Blender file where I can find them and use them? I'm wondering if you have to store coordinates with the terrain object for the 'Relative to initial import' part to work. If I can figure out a reprojection for this, I'd be all kinds of happy!
Hi, I need to georeference the Google tiles. I want to use a GIS package (Global Mapper) to reproject the data to a state plane coordinate system. What is the relationship between the coordinates of the imported geometry in Blender to WGS 84 or another coordinate system? Thanks very much! -Donald Newlands