Importing data from shapefiles, multipart lines
I'm learning more and more about transferring files between Caltopo and GIS software (I use QGIS). One problem can be created when initially digitizing in Caltopo, moving those records into GIS for tweaking, and then reimporting back to Caltopo, where data anomalies hidden in the original Caltopo digitizing can crop up.
I recently digitized a set of lines for a new regional trail system, using Caltopo. This is a handy way of creating new routes, because when you "Add" a new line, the Snap tool in the upper left corner of the map allows you to create new lines that "snap" to existing lines (zoom in until scale bar shows 1 km or smaller, select any option other than "None" or "Lines", and you'll see yellow lines to snap your new line to). This greatly speeds up tracing existing trails or roads, although be sure to carefully inspect your new line, because sometimes the tracing takes shortcuts that you don't intend. It is also easy to undo the last segment easily with the undo tool (use the counterclockwise arrow below Snap tool).
In the course of this work, however, I accidentally saved smaller segments of a longer regional trail that I was creating before I completed it. No worry, I thought. I just started a new line from that point and completed the rest of my route. I then exported all of my new lines as a kml from Caltopo and imported them into GIS. The GIS software gives me more flexibility for creating better map, as well as allowing me to readily join all of the segments of a regional trail into a continuous line with the same regional trail name.
To combine the regional trail segments in GIS, I gave all regional trail segments the same regional trail name in a new field, and then dissolved all of the segments based on the trail name. That left me with just one record for each regional trail, and I thought I was done. However, my partner needed the data in Caltopo, so I simply exported the cleaned up GIS file as a .kml and imported it back into Caltopo. I assumed that this import would bring in only one record per regional trail. Unfortunately, it imported many records per individual regional trail, which surprised me.
After much experimentation, I learned that the original line segments I created in Caltopo were not precisely matched up end to end. At extreme zoom levels, I could see gaps, overlaps, and crazy perpendicular lines (all at the scale of meters) between my segments. When I imported those lines into GIS and dissolved them on regional trail name, the new GIS file simply retained all of those extremely fine anomalies as multiple parts of the same line feature, with one record for each regional trail feature. Those anomalies were retained as I exported them back into Caltopo as a kml file, which created new records for every part of every single GIS record.
I was puzzled about how to find and fix all of these tiny anomalies. There may be more elegant ways to do this (using Topology Checker and "Multipart to singleparts" - see https://erikmartinjordan.com/multipart-singlepart-qgis-vertex-rearrange), but this was my approach that worked well enough.
In QGIS, I selected each regional trail record, one at a time. I then split that one line feature record into its component parts (QGIS>Advanced Digitizing>Split Feature Parts). This turned all of the individual parts into separate line feature records. I zoomed into the connection area where two of these segment lines were supposed to meet and edited the line work (Digitizing Toolbar>Vertex Tool). I found it best to delete all vertices near the intended connection to eliminate hidden overlapping lines (these were not readily apparent). Once the connection area was cleaned up, I turned on Enable Snapping (in the Snapping Toolbar) and dragged the vertex of one line until it clearly snapped to the vertex of the other line. I selected both lines on either side of the connection, and used the CIGeoE Merge Lines plugin to merge both lines into one line feature. I did this for every problematic connection area. When I was done, the attribute table still showed one record per regional trail, but this time each record was a single part features, not a multipart feature.
After cleaning up the line work, I made sure that the Name attribute field contained my regional trail names, and I exported the GIS shapefile as kml (with a new file name, so it doesn't just add records to the previous kml file). When I imported it into Caltopo, it brought in just one record for each regional trail. Yay!
Comments
0 comments
Please sign in to leave a comment.