ESRI Shapefiles are one of the recognised Feature Collection file formats in GPlates. Loading a feature collection from a Shapefile follows the same procedure as any other feature data file - see the Loading and Saving chapter.
Much of this chapter also applies to OGR-GMT and GeoJSON file formats. These formats, along with shapefiles, are all handled by the OGR third-party library.
2. Shapefile attributes
Shapefile attributes can contain meta-data associated with the geospatial data. This data could specify, for example, the feature’s reconstruction plateID, or the times of appearance and disappearance of the feature. GPlates allows you to specify which shapefile attribute field names will be associated with GPlates feature properties, such as the reconstruction plateID. GPlates records this information on disk so that in subsequent GPlates sessions the last used association will be loaded by default. You can change this association at any time during a GPlates session.
2.1. Mapping shapefile attributes
The first time a shapefile has been loaded, you will see the Map File Attributes dialog.
This dialog allows the user to select which file attribute fields will be associated with GPlates feature properties. The feature properties are listed on the left-hand side of the dialog.
|Feature property||Explanation||Expected values|
|PlateID||The reconstrution plateID for the feature||Integer|
|Feature type||The type (e.g. Coastline, COB) of the feature||Two letter code|
|Begin||The time of appearance of the feature||Real|
|End||The time of disappearance of the feature||Real|
|Name||The name of the feature||Text|
|Description||A description of the feature||Text|
|Feature ID||A unique ID for the feature||Text|
|Conjugate Plate ID||The plate ID of any conjugate plate||Integer|
|Reconstruction Method||The method used to reconstruct plate positions||Text|
|Half-stage left plate||For half-stage reconstructions, the left plate ID||Integer|
|Half-stage right plate||For half-stage reconstructions, the right plate ID||Integer|
|Spreading Asymmetry||For half-stage reconstructions, the spreading asymmetry||Real|
Alongside each feature property is a drop-down box showing the name of the file attribute field which will be associated with the feature property. You can use the drop-down boxes to change the file attribute fields which you want to associate with each feature property.
By default GPlates will look for certain file attribute field names, and will initialise the drop-down boxes with the following values:
|Feature property||Default attribute field name|
|Conjugate Plate ID||PLATEID2|
|Half-stage left plate||L_PLATE|
|Half-stage right plate||R_PLATE|
If the default field name for a feature property cannot be found in the shapefile, the drop-down box will be initialised with <none>.
Once you have selected the mapping you want, clicking OK will load the shapefile.
2.2. Recording the mapping
Once a mapping has been selected, GPlates records this information on disk. If the shapefile was called mydata.shp, the mapping information will be stored in the same folder in a file called mydata.shp.gplates.xml. The next time a user loads mydata.shp, GPlates will look for the file mydata.shp.gplates.xml. If this mapping file is found, GPlates will use the mapping contained in it, and will not force the user to use the Map File Attributes dialog.
2.3. Changing the mapping
The mapping can be reset at any time during a GPlates session.
Open the Manage Feature Collections dialog (Ctrl+M)
Select the File Properties icon for the file whose mapping you want to change.
The Edit OGR Configuration dialog will appear; the lower part of this dialog behaves in the same way as the Map File Attributes dialog described above.
When you have selected the fields for your mapping, click OK.
|Re-mapping the shapefile attributes will update the *.shp.gplates.xml file on disk.|
2.4. Dateline wrapping
Shapefile datasets which contain geometries spanning the dateline (180/-180 degrees longitude) can be problematic to view in GIS tools such as ArcGIS (where such geometries might appear rendered with horizontal lines). If desired, GPlates can clip such dateline-spanning geometries to the dateline, making it more suitable for viewing in ArcGIS. (Note that this will also result in geometries being divided up into multiple geometries).
To enable this feature, select the Wrap polyline and polygon geometries to the dateline checkbox at the top of the Edit OGR File Configuration dialog. If this is selected, geometries will be clipped to the dateline the next time the file is saved to disk.
|Dateline Wrapping is also available as an option in the Export tool.|
2.5. Viewing Shapefile attributes
Shapefile attributes can be viewed in two ways:
For an entire feature collection.
For individual features in a feature collection.
Go to the Features Menu in the menu bar.
Select View Attribute Table
The Attribute Table dialog will appear.
The file attribute field names are displayed at the top of each column. Each row of the table corresponds to a single feature in the feature collection, and displays the attribute values for that feature. If there is more than one shapefile feature collection loaded, you can use Feature Collection drop-down box at the top of the dialog to select the feature collection whose attributes you want to view.
File attributes for a single feature can be viewed through the Query Feature Properties dialog - see the Interacting with Features chapter.
2.6. Editing Shapefile attributes
Shapefile attributes can be edited through the Edit Feature Properties dialog - see the Interacting with Features chapter.
|Only the value of shapefile attributes can be edited. Field names and field types cannot be edited.|
|You cannot create new shapefile attribute fields or delete existing shapefile attribute fields.|
3. Spatial Reference Systems
Some shapefiles, and other OGR-supported files, provide a spatial reference system (SRS) along with geometrical and attribute data (see More about the Shapefile format below). Such an SRS can provide information such as scales, projections, and datums, and determines how the geometries are interpreted and displayed on the GPlates canvas. If a shapefile provides an SRS, it will be detected automatically by GPlates. GPlates will internally convert any non-WGS84 SRS into WGS84. If no SRS is provided, GPlates will interpret the data as having a WGS84 SRS.
On saving a shapefile which had a non-WGS84 SRS, GPlates will prompt the user to select either saving in the original SRS, or saving in WGS84.
Data exported from the Export tool are always exported using the WGS84 SRS.
4. More about the Shapefile format
The ESRI Shapefile format is a file format allowing storage of geospatial vector graphics data and metadata. An ESRI Shapefile is a collection of (at least) 3 files with file extensions ".shp", ".shx" and ".dbf". A shapefile called mydata will consist of the files:
mydata.shp mydata.shx mydata.dbf
The geospatial data are stored in the ".shp" and ".shx" files; the meta-data (attributes) are stored in the ".dbf" file. When loading a shapefile feature collection, you only need to select the ".shp" file; the ".shx" and ".dbf" files are loaded automatically. The file filter used in the Open Feature Collection dialog will show only the ".shp" form of shapefiles.
Shapefiles will often contain extra files providing additional information; projection and SRS information for example can be provided in ".prj" files. If a shapefile provides SRS data, GPlates will read this information and internally convert the data to the WGS84 SRS (see Spatial Reference Systems above).
|When copying shapefiles on disk, remember to copy all the relevant parts of the shapefile.|
The ESRI shapefile specification can be downloaded from http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf.