A brief recipe for making a 3d model of California or other States.
There are many reasons you may wish to have a simplified 3d model of California or other States. It could be to help guide a 3d printer or for a video game.
There are also many ways to collect, organize and prepare the data for rendering. QGIS for example is a good tool and if you have commercial licenses for ESRI this is pretty much a single click operation.
I went with freely available data and tools and used shell based commands that could be automated in theory. This was done years ago but I thought it may be worth sharing the approach:
- Where is the best elevation data?
NASA’s Shuttle Radar Topography Mission (SRTM) data was released in 2015. It’s a best source of elevation data for planet Earth.
Elevation data itself is typically managed as a kind of grey-scale image. The color is the elevation. [ https://library.carleton.ca/help/dem-formats ] . Ben Discoe’s VTerrain project has some useful tips about this format in general — but generally speaking it is pretty simple and pretty well known. [ http://vterrain.org/Elevation/SRTM/ ].
Theory aside — the best source for the actual data I found to be:
CGIAR-CSI SRTM 90m DEM Digital Elevation Database
The NASA Shuttle Radar Topographic Mission (SRTM) has provided digital elevation data (DEMs) for over 80% of the globe…
2. How does one merge the raw data pieces together?
The data on the above site was released in tiled segments — so multiple requests are required to build up one whole state, and one also ends up with extra noise of nearby states.
One way to merge pieces together to cover a whole state is using gdalwarp. Here’s a small script that can do the job:
Here is another way — using gdal_merge:
/opt/local/share/examples/py27-gdal/scripts/gdal_merge.py srtm_12_04.tif srtm_12_05.tif srtm_12_06.tif srtm_13_05.tif srtm_13_06.tif srtm_14_06.tif -o big.tif
3. How does one cut away and clutter that is not inside a state boundary?
This took a bit more research — there were several suggestions about how to clip away the extraneous data from other states:
I also found some useful shape file outlines that you can use to cut an image against in order to get only a single state:
Here is how a shape file can cut a tiff:
gdalwarp -cutline test.shp -crop_to_cutline -dstalpha big.tif clipped.tif
As well these images are going to be fairly large. Here is how to lower their resolution:
gdalwarp -ts 1600 0 -r cubic -co “TFW=YES” srtm_12_05.tif test.tif
4. Converting to some kind of 3d format such as OBJ.
There are many tools to convert SRTM / TIFF files to OBJ such as:
I found actually that I preferred to use Blender3D:
The reason for this was that I massaged the state quite a bit — getting it to look the way I wanted, stretching the perceived elevation. I found that magnifying the vertical elevation by 10x or so helped convey the data better to the average user. I also found that there was still a bit of remaining noise — spikes and holes — which were easy to remove with Blender. I also ran a smoothing pass, removed unused vertices and decimated the geometry. At the top of this page is a photograph of the final result. Here’s a link to a rotatable 3d model using 3js of the same file: