Structures
ESRI shapefile support
SBMT has limited support for loading and saving structures in the ESRI shapefile format. While SBMT currently distinguishes between five types of structures (paths, polygons, circles, ellipses, and points) shapefiles use a more basic set of primitives (e.g. LineString, Point), and only one type of geometry primitive can be stored in a single shapefile.
Export from SBMT to ESRI shapefile
Each type of SBMT structure can be exported from its respective tab in the Structures toolbox panel. Click the Save as... and select ESRI Shapefile Datastore. Shapefile geometry is written in Lon/Lat coordinates with a WGS84 coordinate reference system.
SBMT Structure | ESRI Primitive | Control Points Filename | Lon/Lat Geometry Filename | Geometric Attributes |
---|---|---|---|---|
Points | Point | -- | filename.points.shp | -- |
Paths | MultiLineString | filename.paths-ctrlpts.shp | filename.paths.shp | -- |
Polygons | MultiLineString | filename.polygons-ctrlpts.shp | filename.polygons.shp | -- |
Circles | MultiLineString | -- | filename.circles.shp | center, radius, flattening, angle |
Ellipses | MultiLineString | -- | filename.ellipses.shp | center, radius, flattening, angle |
Points
TODO
Circles and Ellipses
TODO
Paths and Polygons
Because SBMT represents paths and polygons internally using two levels of granularity (control points and fine geometry) it writes out two separate shapefiles for these structure types. This allows shapefile users to
- load highly-detailed surface-conforming SBMT paths and polygons into applications such as ArcGIS, and
- load and edit control points in a GIS application and re-import the control points into SBMT.
Shapefiles containing path and polygon fine geometry, e.g. paths.shp and polygons.shp, are ignored by SBMT; only paths-ctrlpts.shp and polygons-ctrlpts.shp can be imported by SBMT. This is an important distinction, as SBMT is not designed to import structures with hundreds or thousands of segments. Rather, SBMT expects just a few control points to be specified, from which it maps the implied paths and polygons in finer detail on the fly.
Example 1: Exporting SBMT-generated paths on Eros to QGIS3
First, enable the coordinate grid and labels in the 433 Eros tab
Go to the Structures tab, select Paths, and draw a path on the body. Note the lon/lat coordinates of each control point, which have been circled in the image below.
Click Save as... / ESRI Shapefile Datastore..., enter a filename prefix e.g. "myDataStore", and save.
Numerous files will be generated, including two .shp files:
These datastores can be read into the freely available QGIS3 application. After downloading, installing, and starting QGIS3, click "Datasource Manager"
and browse to the SBMT-generated shapefiles:
Double click myDataStore.paths.shp close the Datasource Manager; the path should now be visible in the main QGIS3 window. Enable the grid by clicking "View" / "Decorations" / "Grid"
and then click "Enable grid" and "Draw annotation" in the dialog that pops up.
Note how the path curves across the surface, with vertices at the exact lon/lat as shown in SBMT above. The coordinates of each control point are roughly (0,0)-(20,20)-(30,-30)-(70,40).
Reopen the datasource manager and double-click myDataStore.paths-ctrlpts.shp. Unlike the more detailed "paths.shp" file there is no interpolating geometry in the control-points file; QGIS3 simply connects the handful of control points with straight (lon/lat-space) lines.
Example 2: Importing edited SBMT control points on Eros from QGIS3
Now we will edit the control points and import the result back into SBMT. Discard the current work by clicking "New Project", then reload myDataStore.paths-ctrlpts.shp and re-enable the grid. Click "Select features", click on the lines representing the control points in the main window, "Toggle editing" on, and then enable the "Vertex Tool".
New Project
Select Features
Toggle Editing
Vertex Tool
Hover over the midpoint of one of the segments, double-click the red "plus" icon,
drag it to a new location, and double-click again.
Save the newly edited control points to a shape file. Click "Layer" / "Save as..."
and choose a filename, e.g. "test".
The exported file structure should look something like this:
Finally, back in the Paths panel on the Structures tab click Load... / ESRI Shapefile Datastore and browse to and open test.shp. An error message will pop up regarding the SBMT shapefile naming convention,
Click "Yes" to open the renaming tool, leave "test" as the file prefix, and select "Paths" as the file content type.
Click "OK" and the files will be renamed accordingly on disk:
The path should now be visible in the SBMT main window. Note the presence of the newly created (QGIS3) control point, while the fine-grained geometry connecting it to its neighbors has been generated by SBMT on the fly.