Exporting and Merging |
Top Previous Next |
Exporting an Entire Shapefile or a Subset of Records
The shapefile export dialog can be accessed in several different ways. An entire shapefile can be exported by selecting its layer in the Layers window and clicking the "Export" button on the right panel. A more flexible approach, however, is to click the "Open Table" button on that panel. A selected subset of records, possibly with fields reordered and certain fields excluded, can then be exported by right-clicking one of the highlighted records and choosing Export shapefile from the context menu. Finally, you can load a group of features into the Selected Points window (say by text search or by dragging a rectangle on the map), then select either Export shapefile (for a direct export) or Open table for branch from the branch's context menu:
In all cases the export dialog should look similar to the one shown below. If you want to use this function to either change field types or add new fields, you must specify a modified template file of the type described in Template File Format. Simply deleting unneeded fields doesn't require a template if you're exporting from a table view. Just hide those layers first by selecting Column visibility table header's context menu, then be sure to check the box labeled Or use table layout in the Export dialog as was done here:
Notice that a checkbox labeled Create 2D shapefile is enabled, not grayed, because the program recognizes that the source is not a 2D shapefile. Other possible types are pointZ, polylineZ, polygonZ, pointM, polylineM, and polygonM. The M types store (in the SHP file member) one extra number with each coordinate pair, a "measure" denoted by M. The Z types store both M and a vertical component Z. Given that the program doesn't yet use or provide access to these numbers, you might want to leave this box checked. The extra data will then be removed, conserving space and making the 2D coordinates editable. (See Limitations.)
M and Z shapefiles are relatively rare, with most GIS programs treating them as if they were 2D. The Texas Department of Transportation (TxDOT) has been making state-wide polylineM shapefiles available, where M is the interpolated travel distance along the road represented by the polyline.The cave mapping program Walls optionally exports pointZ and polylineZ shapefiles, where the Z values are elevations. A popular program for visualizing 3D shapefiles is the ArcGIS 3D Analyst extension. Other programs, such as Global Mapper, can convert 3D shapefiles to KML for viewing in Google Earth.
Copying Records from One Shapefile to Another
Transferring records between shapefile layers is possible if the source and destination shapefiles have compatible structures. This requires that at least one field name is common to each shapefile, and that the types for matching fields are either 1) the same, 2) both either C (text) or M (memo), or 3) both either C or N (numeric). This operation is currently enabled only for 2D point shapefiles, but I plan to relax this restriction.
The Selected Points dialog is one place you can accomplish such a merge. First, select the records from the source shapefile using a convenient method. Next, right-click the appropriate branch (or single leaf item) in the left panel of the Selected Points window and choose Copy branch to layer (or Copy point to layer). You'll then be offered a list of suitable target shapefiles -- that is, all project layers that are compatible and editable, possibly with their visibilities turned off. (If there are no such candidates, the option simply won't appear in the menu.) Once you choose a target you'll be asked to confirm the copy -- a prompt you can disable for subsequent copies to the same target.
If the structures aren't identical apart from the order of fields, you'll be informed of the differences, warned if data truncation is a possibility, and asked to confirm the copy once again. (This prompt can't be disabled.) If you proceed with the operation and truncation actually occurs, the first field and record number where this happened is reported upon completion.
If the Selected Points window is already displaying items from more than one shapefile, you can also perform a copy operation by left-dragging either a branch or single item of one shapefile to a portion of the tree representing another. When you use this method, the copied items will disappear from the source shapefile's selection and appear as selected items in the destination shapefile. This is still only a copy, not a move; records in the source shapefile aren't deleted.
Another place to perform copy operations is in a table view, where the pop-up menu for highlighted rows will have a Copy selection to layer option when suitable targets are available. There are two reasons why this might be the preferred approach. First, the selection can be the whole table or any subset of rows, possibly non-contiguous. Second, the copied records remain selected, so it's trivially easy to accomplish a move by right-clicking once again and choosing Delete selection.
|