Giving a second try at using Ponoko for my walking tracks after this moderate success. Sha and Rachel of Meshu suggested etching the actual GPS traces on top of the blob, which I thought was clever. So here’s what I’m doing step by step.
1. Create a view for my tracks with simplification
CREATE OR REPLACE VIEW simple_tracks AS SELECT tracks.ogc_fid, st_simplify(tracks.wkb_geometry, 0.0002) AS wkb_geometry, tracks.name FROM tracks;
2. Use QGIS to make a map of all those tracks, then use “Save as Image” to get a PNG raster image. I made the lines of the tracks be 1mm solid black and zoomed in. Note QGIS exports the image at the size visible on screen, so make that window big first!
3. Use Pixelmator as a paint program to calculate the concave hull of all my walks. Basically I did a flood fill of the background of the image to some random color, then selected all the pixels of that flood fill color, then inverted the selection. Now my selection is my concave hull! I then used a black brush to fill in the selection so I have a basically monochrome image, also erased some hanging bits to have a cleaner shape. This is the step I wish I could just use ST_ConcaveHull() in PostGIS to do, or some other topology algorithm.
4. Convert the raster blob into a path. Load the painted image into Inkscape, choose Path / Trace Bitmap, and use the default Brightness cutoff. Click “OK”. Nothing visible happens, but now if you move the raster out of the way you’ll see there’s a second black shape. This one is a vector object. Edit the style so it has no fill and a black outline, just to make it obvious.
5. Create a new Inkscape document from the Ponoko starter kit.
6. Copy and paste my outline from step 4 into the new document, then update the stroke style to a cutting line (0.01mm, #0000ff). Note the caution about XQuartz and the Mac clipboard not copying vector objects.
7. Reload my GPS tracks into QGIS. Be careful to load the simplified tracks, for fewer points. Then use the QGIS Print Composer to save the map as an SVG. That tool is really confusing, basically you use the “add map” button to swipe out a rectangle on the page. Scale and centering doesn’t much matter, all we really want is the SVG bits.
8. Load the QGIS generated tracks SVG into Inkscape. Break the group and select the hairball of individual tracks. Copy and paste it into the main document from step 6. Adjust the style of the track hairballs to a light engraving line (0.01mm, #ff00ff). Then, the sadness, scale and align the track hairballs so they just match the outline from step 6. Visual process, non-exact, we’ll see how it looks.
9. Save the SVG and send to Ponoko!
This took me a couple of hours. All this paint program fiddling is terrible; the right thing is to do this all with code. Calculate that concave hull, dump it as SVG. Calculate the union of simplified tracks, clip it to fit inside the concave hull, dump it also as SVG. Combine with the same reference and done! PostGIS has an ST_AsSVG that helps, but until I can get it to calculate the outline of my tracks the way I need there’s not much point.