Friday, February 17, 2023

What's new in TouchTerrain 3.6?

 What's new in TouchTerrain 3.6?

  • Updated the TouchTerrain ReadMe on Github with info about newly added options and on running TouchTerrain in the more standalone mode  Standalone mode is more flexible than the Web app, e.g. it can be used to create 3D models from terrain raster files (typically geotiffs). It is also able to handle data that is larger than what the web app allows.
  • If you are curious, simply run this Colab jupyter notebook (only requires a free Google account). It also provides a gentle intro to using the TouchTerrain python interface.
  • Minor facelift: the URL https://touchterrain.geol.iastate.edu/ now leads to a splash screen, once clicked on, https://touchterrain.geol.iastate.edu/main will show the actual web app. For most users this should not change anything, however, if you have pre-3.6 URLs to models with certain parameters (e.g. http://touchterrain.geol.iastate.edu?trlat=44.746) you will need to change them to  this: http://touchterrain.geol.iastate.edu/main?trlat=44.746 for them to work with 3.6
  • Added the min_elev option, which will set a models minimum elevation regardless of what the actual minimum is. Usage as a manual setting in the Web app: "min_elev": 500
  • Added a way make the the area selection box uniformly larger or smaller (uniform scaling around its center). At the bottom of the Area Selection group, changing the number from 1.00 will scale the box accordingly. E.g. changing it to 0.95 (and hitting Enter) will shrink the box by 5%:


  • With the popularity of carving terrain models with CNC machines, I reached out to Steve M. Potter, who has used TouchTerrain in this role for a while and has documented his experience as an Instructable (Youtube version): Step 3: Obtain the STL Model of the Terrain. He's also involved in this makerspace: https://steveMpotter.tech Here's some more info he sent me:

    I have been carving terrain models on a CNC router for 5 or 6 years. I used to spend about a week developing the 3D model from satellite imagery…Until I discovered TouchTerrain. This tool makes the process of creating a carvable STL model SO much easier. It is a simple matter of choosing a place to carve, which dataset to use (I prefer the AW3D30 dataset from JAXA, which covers the globe) and then a few parameters in the TouchTerrain GUI. I go over this process in Step 3 of my Instructables tutorial, and starting around minute 5:35 in the YouTube video. The process is pretty much the same as for making a 3D printed terrain model, but there are a number of additional concerns when carving wood, as well as aesthetic issues to consider. I like to use birch plywood, so the plies end up looking like contour lines of a topo map. For example, https://youtu.be/QPqFPspLMyI?t=318 .


    I have carved smaller models, 200x150mm, which are good to bring on hikes to help with orienteering and path planning, for example https://photos.app.goo.gl/h4JgHpfM9AjNESou6 . I have also carved larger models, nearly 1 m across, as works of art to be hung on the wall. These can be embellished with markings for trails hiked, or places of sentimental value, or carved with text to make them personalized. For example, https://photos.app.goo.gl/T4de4HDqDypZdc5r7 . One can also use laser engraving to add streets or other features to wood carvings. TouchTerrain has a feature to lower the sea level by a few mm, which is good for creating a resin pour on the model to represent water, for example https://photos.app.goo.gl/WcPnZKHQYp719qWA8 .

Friday, April 30, 2021

What's new in TouchTerrain version 3.3?

  • Help "bubbles": When you mouse-over or click on a question mark icon, a help text (popover) will appear. If you clicked on the question mark, the popover will remain visible until you click on it again.


  • 3D printer option settings for CNC users: This is mean to help the around 15% of TouchTerrain users who create terrain models using CNC machines. There's no direct equivalent to physical print size or nozzle nozzle, diameter,  so for CNC users, I've added three presets: small, medium, large size, which is related to the final, physical size of the piece of wood; and low, medium and high detail, which is related how much detail your carve can potentially contain.
  • Medium offers a reasonable compromise of level of detail and the size of the STL. If you want a smaller STL and can deal with less detail, set this to low detail. If you are sure that you need more detail, select high, which will create larger STL files and take longer to process. Preview can help to decide on the best level of detail but, as many factors influence the final outcome, you'll have to experiment with different settings in your CNC software and see which work best
  • For CNC users, the rest of the 3D printer settings can be left at their default level. Be aware that using a >1x z-scale can help to make low-relief terrain more interesting. However, this can also be done later in your CNC software.


  • Auto-height values for z-scaling: Many users who leave the z-scale value at the default 1x may be missing out 3D terrain prints that are more visually appealing, especially in low-relief areas. It good practice to set a z-scale that end up creating a 3D print with at least 50 layers, as less layers will not be able to image small terrain details, such as meandering river beds. 
  • However, it can be a pain to determine the "best" z-scale, which in TouchTerrain can really only be done through trial and error using the Preview, (It is much easier to increase the z-scale in the slicer software until it looks interesting!). I've added a few presets for the desired height of the model (i.e. the physical distance from the lowest elevation to the highest) in either mm or inches. 
  • A height of 20 mm is good starting value. Preview the model and change the height as desired. The actually used z-scale will be given in the log file.


  • kmz files for polygons: You can now use kmz and kml files to provide polygons to define your print area's boundary








Wednesday, March 31, 2021

TouchTerrain Story Map

I've made my first ever ESRI Story map about TouchTerrain:  https://arcg.is/11Cv5D It re-uses some of the material from the AGU 2020 conference poster but is far slicker!





Tuesday, March 30, 2021

Version 3.2.1: Z-scale bug fix

Z-scale fix 

  • Well, this is embarrassing! Simon Scherrer recently pointed out that my mesh models where hilariously tall when applying a large z-scale. 
  • Turns out that at one point I had done the z-scaling in one function, then forgot about it and applied it again in another function! 
  • While easily fixed, this means that any z-scale larger than 1.0 was wrong (not sure since when, must be several years ...). For most users that's likely not an issue b/c it wasn't that obvious at low (>1.0) z-scales and many (including) myself have no real world experience with how a certain z-scale should properly  look like. (This is what convinced me that my old z-scale of 5 was WAY too much! Also, I like that they call the z-scale Boost factor!)
  • Also, I think most user would have dialed in a appropriate z-scale  based on visual inspection. However, if you've been using TouchTerrain for anything scientific where proper z-scale matters you should account for my error and either correct your effective z-scale to the square of what you requested pre version 3.2.1 or re-do you model with the new (correct) z-scale method now in place. 
Old (pre version 3.2.1) z-scale of 5 aka Mordor mode!







Hillshaded relief with proper z-scale of 5

Fixed (>= version 3.2.1) z-scale of 5

  • Again, thanks to Simon Scherrer for bringing this to my attention!




Friday, March 12, 2021

What's new in TouchTerrain Version 3.2?

Docker version of TouchTerrain

  • I created a Docker image of TouchTerrain that makes is easy(er) to run the stand-alone version via a jupyter notebook.
  • After installing the image and running the container, you will have a virtual Linux box running inside your PC/Mac, with all required python packages already installed.
  • Shell scripts are provided to install the latest version of TouchTerrain and to run a jupyter server inside the container. The server that can be accessed through your standard, local browser and you can download and upload files through jupyter.
  • A new notebook (TouchTerrain_jupyter_for_starters.ipynb) will hopefully make is easy for beginners to work through the workflow of creating a 3D terrain model file in standalone mode.
  • The github repo for the Docker version is: 
    https://github.com/ChHarding/TouchTerrain_jupyter_docker 


Added two new DEM sources:

  • NRCan/CDEM: The Canadian Digital Elevation Model (CDEM) is part of Natural Resources Canada's (NRCan) altimetry system and stems from the existing Canadian Digital Elevation Data (CDED). The CDEM is comprised of multiple DEMs with varying resolutions. These vary according to latitude and have a base resolution of 0.75 arc-seconds (about 20m).

  • AU/GA/AUSTRALIA_5M_DEM: The Digital Elevation Model (DEM) 5 Metre Grid of Australia derived from LiDAR model represents a National 5 metre (bare earth) DEM which has been derived from some 236 individual LiDAR surveys between 2001 and 2015 covering an area in excess of 245,000 square kilometres. All available 1 metre resolution LiDAR-derived DEMs have been compiled and resampled using a neighbourhood-mean method to 5 metre resolution.

Note that both DEMs are image collections, rather than a single image as can seen here for the Australia DEM (black patches):




Zoomed into an urban area. As Lidar cannot image water surfaces, these areas will always be set to NaN and will be omitted from the terrain model.






Even at "only" 5 m resolution, it still shows some nice details!






























CDEM coverage:




Saturday, November 21, 2020

What's new in version 3.1?

Optimized Wall layout for polygon-based models

For 3.1, I changed the way walls are set up if the models was created via a polygon. This means that the raster contains NoData (NaN) cells. Cells containing a elevation were each simply expressed as a quad,  with a top and bottom and possibly with one or more walls. This simple rasterization method worked but lead to a gazillion "corner quads" (i.e. quads with 2 or 3 walls). And while these corners are typically nearly imperceptible in the final 3D print, I found that it was very hard on the motion system of my 3D printer to rattle along all those tiny teeth and it also took longer to print.

Old method

My solution is to "snip off" half of any quad that has 2 adjacent walls and replace them with a single diagonal wall:

New method

 




















Note that I did not optimize quads with 3 adjacent wall b/c it would have to either randomly choose one of the two possible diagonals or do something drastic like removing this quad or replace it with some sort of "nose".

Here's an example of a non-trivial case created with this optimized wall strategy:











  

Added the MERIT 90m DEM source

It's only 90m resolution but is more precise, so maybe it's useful for those printing river networks and other flat areas (like Iowa :)


MERIT DEM a high accuracy global DEM at 3 arc second resolution (~90 m at the equator) produced by eliminating major error components from existing DEMs (NASA SRTM3 DEM, JAXA AW3D DEM, Viewfinder Panoramas DEM). MERIT DEM separates absolute bias, stripe noise, speckle noise and tree height bias using multiple satellite datasets and filtering techniques. After the error removal, land areas mapped with 2 m or better vertical accuracy were increased from 39% to 58%. Significant improvements were found in flat regions where height errors larger than topography variability, and landscapes such as river networks and hill-valley structures became clearly represented.

Another potential benefit is that MERIT is not defined for offshore locations, making it convenient for clean models of coastal areas, where you may not want a "flat ocean"

Using the AW3D30 DEM:
AW3D30
Using the MERIT DEM:









Friday, October 9, 2020

TouchTerrain 3.0: New GUI, place search, kml polygon file upload

What's new in Version 3? 

New GUI: With version 3.0 (October 2020), TouchTerrain has gotten a serious facelift. Gone is the utilitarian ca. 1995 aesthetic, replaced by a Bootcamp 4 based GUI. This is my first ever dip into using bootcamp and there are probably still some details to be worked out. 

GUI responsiveness: The Bootcamp GUI implements what it calls responsiveness which means that (to an extent) the app will try to dynamically"compact" itself when used with small screens (tablets, smartphones). Note that this should work on a smartphone but will look a bit weird. Hopefully most users will have a reasonably wide display when using the app!

GUI size adjustments: You will notice that there are 3 main parts ("cards" in Bootstrap speak) to the right of the map. Clicking on their titles (e.g. on Area Selection Box:) will grow or shrink them. By default, only the Terrain Settings and the 3D Printer Options parts are "open", the Area Selection Box (which hides the lat/long coordinates of the box corners) is closed. Opening all three together will make the green Export Button on the bottom to be shoved out of sight, so you'll have to close a part or scroll down to click on it.

Manual box coordinate entry: In version 3, the four coordinate fields inside Area Selection Box are now active. Changing any of the numbers and hitting Enter will immediately resize the red box accordingly.

"Oversampling" warning: If you configure things in a way that TouchTerrain will interpolate the DEM into a higher (more detailed) resolution that what the DEM source can provide, the Current DEM resolution value will turn yellow. Ex: The source DEM resolution is 30 m but you're requesting 20 m. Using 20 m will still "work" but it's counterproductive b/c it won't magically create more detail and your files will be needlessly larger than if you had configured it to resample at say 32 m instead.

Place search bar: As is standard in many other Google Map applications, you can now search for a place by typing a search term into the box and pick one of the five suggestions displayed.  Your map view will fly to the result you picked. Be aware that it will NOT move the red selection box to your new view, so don't forget to hit the blue Re-center box button when needed!

Use a Polygon from a kml file: If you have a kml file that contains a polygon or a polyline (e.g. the outline of a state) you can upload it to the app and use it as boundaries for the 3D model you download. 

To upload the kml file, click on Browse, select a kml file from you local drive and hit Open. Note that is has to be kml file, not a kmz file! Kmz is just the zipped version of kml. To use a kmz, unzip the kmz file, which will give you a file called doc.kml, just rename that and then upload it. You could of course also use Google Earth to digitize a polygon, save it into a kml file and upload it to the app.

After the upload your map view will jump to the area and will see your polygon in yellow inside the red box. Adjust the other settings and then hit Export. You will see a note (Using X points from kml file as polygon) and you model (and geotiff file) will be clipped (masked) by the polygon.

Note that this polygon will be cleared if you move the red box or if you use functionality that requires the app to reload, such as changing the DEM source or the hillshade settings. This is needed, b/c the polygon isn't inlined into the URL (like all the other settings). But, it should be pretty quick to re-upload the kml file again! Finally, be aware that if your file contains multiple polygons or polylines, only the first will be taken.

Other changes:

  • URL: Depending on you system you may no longer see the full URL in the browser. However, we now give you the full URL at the end of the export (as simple browser text), so you can still use it to "give" your model to somebody else.
  • GPX path lines:  On the standalone version of TouchTerrain, you can now drape path lines from gpx files over your model.
  • Map with jupyter notebook: The jupyter notebook standalone version can now show you an interactive Google Map in a notebook cell (using the geemap module). It also lets you digitize a rectangle, circle or polygon onto that map and use it as your model area.