Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

Weekend Hack: Printing 3D Tiles

$
0
0

A friend recently got a Makerbot (3D printer) at his work, and he invited me to play around with it. I thought it'd be neat to see what printing a map "tile" might look like. Unfortunately, his printer broke down late last week, but luckily our Portland office space has a Makerbot they charge for time on. So, after a handful of nights messing around, and a little cash, I managed to print Mt Hood based on open elevation data:

mthood

This print is based on this model, which you can see rendered in 3D on Github:

mthood-model

Some more photos here.

How I did it

  1. Get elevation data. I found the tilemill help page about working with terrain data, and picked SRTM. Mostly, this was because I was confused by NED. After figuring out how SRTM data is organized, I grabbed http://dds.cr.usgs.gov/srtm/version2_1/SRTM1/Region_01/N45W122.hgt.zip, which contains the area from Mt Hood to a bit north of the Columbia River.
  2. Fill in data gaps with gdal_fillnodata.py. SRTM data has holes every here and there, particularly at the top of Mt Hood.
  3. Build a greyscale color-relief image based on the cleaned data with gdaldem.
  4. Crop the image to Mt Hood only. SRTM data comes as one degree by one degree chunks of the world, which is a little bigger than I wanted to print.
  5. Produce an STL model from the previous image. STL describes a 3d object with triangles. There's a neat tool for linux called png23d, which will take a PNG and try to build a model out of it. It uses the greyscale value at each pixel to determine the z axis. It works pretty well.
  6. Repair the resulting model as best as is possible. That STL will have all sorts of disconnected edges, and places where more than two triangles meet. I used netfabb basic, which automatically removes most of those problems. Here's the model we got (wait for it to load). Github renders stl! Pretty cool. You can zoom in and change views and stuff.
  7. Slice the STL to S3G for actual printing, and send to the printer. S3G describes actual coordinates the printer should pump out plastic to. We ended up using ReplicatorG, as MakerWare seemed to quit printing at unfortunate times.

Bumps along the way

Some problems I ran into/things I did to fix problems:

  • Printing is slow. This print took over two hours, and it's about 2.5" on a side.
  • It can be a challenge to find the right gdal tool for the task at hand.
  • Figuring out how to fill in gaps in spotty data.
  • Producing a decent color map for gdaldem. Mine is ok.
  • Generating STLs that don't have a bunch of problems. png23d seems pretty good, but we're asking a lot. Check out how many faces the model has!
  • What's up with the funky bump at the top of the mountain? That's from me not being good at data fixing.
  • Sometimes the plastic extruders jam up, and printing has to start from scratch.
  • Sometimes the model just breaks while being printed.

Here's a short video of things failing to print from a couple days back.

What can we do with this?

I am not sure, but some ideas:

  • Automate the toolchain, so that it's easier to produce "tiles"
  • Write something that breaks a large set of elevation data into a grid for printing. Example: you want a table-sized print of the North Cascades in Washington, so we break it up into manageable chunks for printing.
  • Consider playing with building data in cities. Perhaps printing city blocks from building height data.
  • Diorama contests
  • Board game pieces

Viewing all articles
Browse latest Browse all 2230

Trending Articles