Carto Tutorial

Making a Carto-Freehand Cave Map

by John Ganter,

Document version 2, 23 July 2003. Carto version: 0.8.26 Updated by Ralph Hartley to reflect changes from old Carto versions. See John Ganter's original version 1.

Drawing cave maps remains a very labor-intensive process. Virtually all efforts at automation have gone towards plotting the numbers of the survey traverse in more ornate ways. Just as decades ago, the cartographer then looks at the survey sketch, does a mental transformation, and draws, in pencil or with the computer, a map around the framework of the traverse. If the traverse later moves due to more survey or a closed loop, the map must be more or less redrawn.

Carto is a software application that breaks new ground, focusing solidly on the spatial matching of the sketch to the traverse (morphing) and assisting the cartographer in drawing a dynamic, changeable map with cave-specific symbols.

Map-drawing in Carto is still evolving, but the morphing capability is quite powerful and usable. This tutorial walks through a "hybrid" mapping project that has used Carto to morph sketches that are then imported into Macromedia FreeHand for tracing into a finished map.

I try to provide an introduction to Carto so that cave mappers can see the basic concepts and how they are being implemented in the user interface. Along the way I talk about related tools for managing scanned survey notes, and pass on some lessons-learned. In the conclusion, I tally the times spent on various tasks to give an idea of how Carto might or might not save time.

Getting ready

Software: You should have Carto installed and operational, and a Compass .plt file of the survey traverse. You'll also need a way to get your sketches into the form of PNG graphics files. This example uses a image document management tool called Pagis, Photoshop, and FreeHand. But the concepts apply to other tools, and it is possible to simplify. For example, you might use a single image editing tool to scan and clean up your survey sketches instead of Pagis and Photoshop.

System: I first tried Carto on a 120 mhz Pentium laptop with 32 megs of RAM, running Windows 95. It worked for a small map with a couple of sketches, but was fairly slow. For this large project, especially the switching between applications, I used NT4 on a 350 mhz Pentium II with 256 megs of RAM.

Caution -- Cutting edge technology: Carto is under development, with NO WARRANTY. Even though it is very stable, loss of data and work is a possibility. Windows 95/98/ME are notoriously unstable in memory-intensive uses, and crashes typically scramble files requiring CHKDSK to get the disk straightened out. I recommend that you start small, make lots of file backups, and scale up. For a big project, an industrial-duty operating system like NT4, Windows 2000, MacOS, or Linux/UNIX is recommended.

Steps in the tutorial

Step 1: Preparing Compass plotfiles

Step 2: Preparing the PNG image files

Step 3: Creating Carto Segments

Step 4: Creating Carto output files

Step 5: Importing files into FreeHand

Step 1: Preparing Compass plotfiles

For any kind of mapping, it is critical to detect blunders as early as possible. Once you've begun drawing the map, discovering that a shot was left out requires a lot of time to fix. Check your Compass plots, then save a .plt file. Carto will use this for the station locations. (I should note that Carto will actually remorph the sketches and map if the survey changes (potentially one of its best features), but in general it is best to detect blunders early.)

Step 2: Preparing the PNG image files

Now you need to get your sketches into a form that Carto can morph. Carto accepts Portable Network Graphics (PNG), GIFs, and JPGs. I (RH) recomend PNGs, all else being equal.

Pagis_GettingSketchPiece.jpg (68646 bytes)

Icon_ArrowUp.gif (580 bytes) For the past few years I have been scanning all my survey notes. Pagis ( is a tool that lets you manage multi-page scans as single files that are very compact. A portion of the interface is shown above.  You can see the thumbnails on the left, and a part of the page.

This is a 300 dpi scan. It has 256 gray levels. I have found that if I use few gray levels, or black and white, the grid on the paper and the sketch both become black and legibility is greatly reduced. This is also a dark scan. Recently I have been doing lighter scans at a resolution of 200 dpi. This seems quite adequate, and greatly reduces file sizes.

Pagis has poor export capabilities, so I decided to use a two-part process to get PNG files for Carto to use. I select a section of the page in Pagis; you can see the dashed box above. Then I <CTL>c to copy the piece of image to the Clipboard.

10_PShop_PastedImage.jpg (34067 bytes)

Icon_ArrowUp.gif (580 bytes) Now I <ALT><Tab> to switch to Photoshop. <CTL>n will create a new document conveniently at the size of whatever is on the Clipboard. Then I <CTL>v to paste the image from the Clipboard into Photoshop. Next, I'll lighten it up a bit.

15_PShop_Levels.jpg (38880 bytes)

Icon_ArrowUp.gif (580 bytes) Use Image > Adjust > Levels to change the exposure. For survey notes, typically I slide the far right marker over to the base of the peak, then move the middle marker around until the image looks good.

16_PShop_Actions.jpg (13935 bytes) Photoshop Tip: To access Photoshop functions quickly, I have saved some shortcuts, known as Actions. You can load these into Photoshop and use them yourself. The file is Photoshop_JGActions.atn. Click the little arrow to the right of the Actions tab, then choose Load Actions. Choose Button Mode to make them display as above.

17_PShop_Erase.jpg (29153 bytes)

Icon_ArrowUp.gif (580 bytes) Next, use the Eraser tool. I usually erase most anything I'm not going to trace over, including station labels if they are obvious. On the other hand, you can adjust the Boundary in Carto (see below) to exclude this junk. With a fast system, it may not be worth the time to clean up the sketches.

Choose Layer > Flatten Image, then File > SaveAs a PNG file.

Do this for each section of sketch. Next Carto will morph these images into what it calls "Segments."

Step 3: Creating Carto Segments

Open a Command Window in your Carto installation directory. Mine is C:\b\carto, so it looks like this:

19_Carto_Start.jpg (31827 bytes)

Icon_ArrowUp.gif (580 bytes) You start Carto from a Command Window with the following, where case counts: java -jar carto.jar

Choose File > New Project to create a new Carto .cto file, A dialog will ask for the survey (.plt) file. A new plan named "plan" will be created and the plan editor will open.

A plan [previously called a "Composite" RLH] is a map that includes one or more Segments. And these Segments are shown morphed. A single Carto file (.cto) can include multiple Segment objects and also multiple Plan objects, but in this tutorial we will only use one plan.

Icon_ArrowUp.gif (580 bytes) You will immediately see the whole survey traverse in the .plt file displayed.

30_Carto_Comp_WholePlot.jpg (77934 bytes)

Press the new seg button in the plan editor. It will ask you for the image file of your sketch. The new segment will be added to the plan.

20_Carto_PJPassage_Points.jpg (75954 bytes)

Icon_ArrowUp.gif (580 bytes) You are now working on a Segment in Station mode; the Station box is checked. Here is what you do.

1: Click on a station name in the list, in this case PJ7FH

2: Now click on the new point tool wpe1.jpg (960 bytes)

3: You are now ready to tell Carto which point on the image corresponds to PJ7FH. Click on that point. Carto will label the station, and it will put an asterisk after PJ7FH in the list

4: Keep doing this for each station that appears on this particular sketch. Carto will display and rotate the survey traverse to help show you where the survey stations are. You can move a point with the move tool Carto_StationMove.jpg (5784 bytes) and delete if needed with the delete tool Carto_StationDelete.jpg (5839 bytes)

Tip: Tools in Carto have a slightly different "feel" than most Windows programs. Be patient and you will find that they are powerful and efficient.

The next step in working with a Segment is to give it a boundary, so Carto will know where to morph.

21_Carto_PJPassage_Boundary1.jpg (89013 bytes)

Icon_ArrowUp.gif (580 bytes) Check the Boundary box to switch to Boundary mode.

1: Using the new point tool Carto_StationSet.jpg (5521 bytes), draw a boundary around the area of interest. Carto helps you by "rubber-banding" a box, but you'll usually get at least one inlier area as above.

2: Use the Move tool to move points, or the Delete tool to delete points, in your boundary.

3: If you need to add more points, select the new point tool. Now, move to the line, then hold down the mouse button as you simultaneously insert a point and drag the line. It takes a little practice, but is simple and powerful once you get the hang of it.

Carto now has X,Y geographic positions (from the plot file), pixels in an image that you have told it are the same places, and a boundary. It is now ready to morph the space of the image so that it resembles the space of the survey traverse.

Close the Segment editor. The morphed sketch will appear on the plan (a big segment on a slow computer may appear as an outline for a while).

If the Segment is small, you may need to zoom in to see it. You can do this with the Magnifying glass tool, or by dragging the Scale bar (bottom) and scrollbars.

31_Carto_Comp_PJPassageAdded.jpg (68240 bytes)

You can see that the grid underlying the sketch is now warped slightly. Carto has done the mathematical equivalent of putting the sketch on a sheet of thin rubber, then turned and twisted it to fit the survey traverse.

Tip If the grid lines are badly warped, the sketch and the survey do not agree. If the sketch is good, and drawn to scale, this is a good way to find blunders. Also, go back to the segment editor (choose Segment > Edit Segment) and check that the stations are correctly marked.

If you can't fix the problem, you can sometimes make it look better by un-marking some stations (trust the sketch) or by re-doing it as two segments (trust the data). The cartographer has to decide which to trust. A bad-tie in can twist the grid lines into knots, only fixing the error will help.

But remember, the Carto algorithm doesn't "know" any more about surveys and maps than a sheet of rubber does. So in some cases, the survey traverse line will fall outside the "walls" of the morphed sketch. It's up to the cartographer to figure out how to resolve the differences and draw the map.

Tip: If you New Segment and it does not appear, tweak the scale. The Segment should appear. If it still does not, you may have forgotten to make a Boundary and thus the morph failed without telling you.

Continue adding Segments until the Plan is complete. Remember to save the .cto file regularly.

As Carto evolves, you will be able to draw a complete map in the Plan editor. For now, we'll take a hybrid approach. We'll export the morphed Segments as images that can be imported into FreeHand. We'll then draw the final map over these images using the tools in FreeHand.

Step 4: Creating Carto output files

To get images out of Carto, you will need to "tile" the Plan with Page objects. Each Page can cover many morphed Segments. The Page objects can then be "printed" to files. Here's how to do this.

1: Choose the Page tool

2: Move your cursor to the center of the area where you want the Page. Click and hold the left mouse button as you drag. A Page will appear and size itself.

3: To resize the Page object, use the Select Object tool Carto_SelectObject.jpg (5761 bytes) to grab one of the lines; handles should appear. Then drag the corner handles. (You can change the shape of the Page object by setting the Aspect Ratio in the Page properties.)

4: To move the Page, drag the center handle

5: To edit the Page properties, Right-Click inside one of the handles.

Now you need to think about scale. Carto understands scale, because it has a survey traverse in feet or meters. But most image formats, including PNG, don't store any information except the number of row and column pixels. How those pixels relate to the world in miles, meters, or inches is not retained. So the fact that the sketches were at around 20 feet to the inch, and that they were then scanned at 200 pixels per inch, has been lost.

Fortunately, scale can be recovered with a couple of steps.

First, Right-click inside one of the Page handles to access its properties. The dialog is fairly elaborate, but the section of interest is toward the bottom.

40_Carto_Comp_PageDialog_Bottom.jpg (18634 bytes)

Check Print to image

Enter 10 under Image Scale

Now select the pixels/foot option

Finally, press Change File to set the export filename.

On the main menu, choose Print > Print Images to produce the image from Page 1. It may take awhile, but eventually the PNG file will appear.

Carto has now produced an image at 10 pixels per foot. Open the image in Photoshop and select Image > Image Size to see its dimensions in pixels.

So if you get a 1000 pixel wide image, then you know that image covers an area on the survey traverse of 100 feet. You've got scale back. The only thing left is to help the scale-challenged FreeHand to understand it.

Note: 10 pixels per foot is not a magic number. It seems to work for sketches done at around 20 feet per inch and then scanned at 200 dpi. The Carto station labels are just barely legible. Adjust according to your needs.

Step 5: Importing files into FreeHand

Here is the actual example. Carto exported Page 1 as a PNG that was 2305 pixels wide. 2305 / 10 pixels per foot = 230.5 feet. Since I am drawing my FreeHand map at 50 feet per inch, 230.5 / 50 = 4.61 inches. Once I get this image into FreeHand, I need to make it 4.61 inches on a side (it is a square). (You can use Calculator and Copy/Paste these numbers to where they are needed.)

I start FreeHand and set up my standard mapping environment. This includes bringing in a DXF file exported from Compass, and sizing the DXF to 50 feet per inch. I put the DXF on a layer called DXF.

Next, I do a File > Import and select the PNG. The PNG comes in at some arbitrary scale. But not for long. I select the PNG and place it on a layer under the DXF, since the DXF is transparent and the PNG is not (and unlike a TIF, FreeHand cannot make it so).

41_Freehand_PNG_PlacedAndScaled.jpg (148020 bytes)

Now, I select the PNG, and use the Object Inspector (at right) to set its dimensions to 4.61 inches (within a few thousands of an inch; we're mapping a cave not building the Chunnel). Next I drag a station in the PNG until it lines up with the corresponding station in the DXF.

You can see that the registration between the DXF traverse and the PNG is quite good.

42_Freehand_Png_Differences.jpg (34982 bytes)

Icon_ArrowUp.gif (580 bytes) There are a couple of things to notice. You can see two different Segments, corresponding to two different survey sketches. The lower one was a darker scan, while the northern one is much lighter and almost not usable.

At the point A, you can see an example of the limitations of morphing, not to mention cave surveying. The station dimensions are shown in the DXF. But the morphed sketch is not as wide. Given the nasty conditions of this survey, I was sketching fast so I believe the station dimension. I'll draw a wall something like the red line.

The DXF and the PNGs can be quickly switched on and off to reduce clutter when needed. And after importing and placing the rest of the Segments, it's time to start drawing the map.


Task times were as follows:

Preparing 24 PNG files from Pagis. Copy from Pagis, paste in Photoshop, clean up, save as PNG. 2.25 hours
Creating and morphing 24 Segments 1.75 hours
Placing Segments in Plan 0.25 hours
Creating pages (3) and exporting 0.50 hours
TOTAL 5.75 hours

So I now have about 4500 feet of fairly simple sketch ready to import into FreeHand and trace over. How does this compare to drawing a map in pencil around the survey traverse, then tracing it in ink or FreeHand?

Well, as I've said before, I don't do digital mapping to save time. But I believe that eliminating the pencil draft stage will save time in the overall map drawing process. And the real payoff will come when a future version of Carto can morph the sketches and the drawn Plan as the survey traverse changes from loop closures, etc.