Tuesday, March 31, 2020

Exporting Terrain models with real world coordinates


Exporting Terrain models with real world coordinates

  • Some people would like to import TouchTerrain model files (STLs or OBJs) into software for CAD or 3D Modelling. 
  • At my University (Iowa State), an architecture student imported terrain into Rhino, manually mach a building he designed to its correct place and CNC'd the entire thing!
  • Another request asked for the ability to import a TouchTerrain STL into Blender in order to make changes to it there. Specifically, to combine it with a GPS track in order to make the track visible when the 3D terrain is printed out (more about this later, provided this turns out to have worked ...): Update: this is now an official touchterrain option (thanks to KohlhardtC!), see the gpx option in the github ReadMe.

  • As a result, I decided to add an option to set the xyz coordinates of the vertices inside the STL/OBJ files as something in a global context. (Typically, the coordinates are in mm and the origin is the center of your buildplate ...)
  • Using unprojected lat/long coordinates is out of the question for many reasons (distortions, height, sphere vs plane, etc.), so the only real option is using UTM coordinates, which TouchTerrain already requests from EarthEngine. This makes the x/y coordinates be large numbers, something in 100,000s or even millions, with z (elevation) always in meters. 
  • These UTM x/y coordinates are distances from the intersection of the equator with Greenwich. Here's a web app that show those numbers for the (nearly) entire globe.
  • In theory, terrain models with these numbers, when imported into a 3D modelling system, should show up in the correct place and should also be correct with regard to other, UTM encoded, objects.
  • Sadly, the only system I remotely know how to use is Blender, for which these standard UTM coordinates did NOT work (at least for me)!

  • However, after looking into BlenderGIS, I realized that I could trick Blender in positioning the STL model in the correct place, if I first imported the geotiff of the terrain (which is always given in the zip folder you download). The trick seems to be to still use meters as units but set the origin (0,0,0) at the center of the geotiff.  For this to work, you need to use the "centered" option (see below).
  • I've documented my Blender adventure here (very detailed, illustrated instruction pdf and a zip with example files used). It only deals with draping gpx lines on the topography (which was added as an official option to standalone in version 3) but it will also show you how to center a touchterrain model for use with BlenderGIS. So I imagine this method should also work for placing other types of geometry (like buildings) onto the model using Blender.

  • Using ArcGIS Pro, I was able to import a OBJ terrain mesh from TouchTerrain (with the "UTM" option, see below) into a local 3D Scene and it does overlap nicely with its geotiff. I used the Import 3D Files (3D Analyst) function.
  • To show the fit, I've set the build in terrain to flat. The "shadow" over which the imported OBJ seems to be floating is the geotiff.
TouchTerrain 3D model of Sheep Mountain, imported as OBJ into ArcGIS Pro, local 3D Scene

  • So what now? Well, if you want to try using a TouchTerrain Model in the context of a 3D Modelling software, all you need to do is to set the manual option:
    • "use_geo_coords":"centered" will set the UTM origin to the center of the full tile
    • "use_geo_coords":"UTM" will use the official UTM x/y coordinates
  • Again, this is highly experimental and only tested in Blender (with "centered" and using BlenderGIS to import the geotiff first!) and ArcGIS Pro. If it works for you in another 3D software, please let me know! (If it fails, also let me know, maybe I can make it work ...)

1 comment:

  1. I'm a professional game developer. I need to use the 3D modeling service in my games. I always take a 3D modeling service from Onsite3D. They are the best company that provides the best 3D modeling service at a low cost. 3D modeling Calgary, Alberta

    ReplyDelete