Class ShapefileFeatureTable

All Implemented Interfaces:
Loadable, PopupSource

public final class ShapefileFeatureTable extends FeatureTable
A table of features that typically represents real-world objects created from a local shapefile data source.

A shapefile is a vector data storage format that stores the location, shape, and attributes of geographic features with the same geometry type (such as point, line, and polygon) and the same spatial reference. A shapefile dataset consists of at least three files (.shp, .shx, .dbf), and may include many others. Each of the component files of a shapefile must be smaller than 2 GB. If the minimum required files are not present (or are larger than 2 GB), the table will fail to load. If the file permissions are read-only, features cannot be edited.

See Shapefiles in ArcGIS Pro for more information about shapefile data types and limitations.

On-the-fly projection of a shapefile is supported if an associated .prj file is present. Otherwise, the features are assumed to have the same spatial reference as the map.

A default renderer is used to render a shapefile feature table in a feature layer. In most cases, the default should be replaced with a custom renderer.

  • Constructor Details

    • ShapefileFeatureTable

      public ShapefileFeatureTable(String shapefilePath)
      Creates a shapefile feature table from the local shapefile (.shp) at the given path.

      When creating a shapefile feature table, the path must point to the .shp file and the associated .shx and .dbf files must be present at the same location.

      shapefilePath - a path to a local (.shp) shapefile
      IllegalArgumentException - if shapefilePath is null, an invalid file path or or security permission
  • Method Details

    • getInfo

      public ShapefileInfo getInfo()
      Gets the shapefile info that contains metadata for the dataset.

      If the shapefile has an associated .xml file, a shapefile info object will be created and populated with metadata from the file. If an .xml file does not exist, this object will be null.

      a ShapefileInfo object containing metadata of the dataset
      See Also:
    • isSpatialIndexEnabled

      public boolean isSpatialIndexEnabled()
      True if the shapefile has a spatial index, false otherwise.

      The spatial indexes for a shapefile are stored in .sbn and .sbx files. Usually they are created by ArcGIS Pro. Having a current spatial index ensures that a high level of performance is maintained when drawing and working with the shapefile's features and that the shapefile's extent is accurate.

      true if the shapefile has a spatial index, otherwise false
    • getPath

      public String getPath()
      Gets the path to the shapefile.

      The path must point to the .shp file in a folder accessible by the application and the associated .shx and .dbf files must be present at the same location. The path can only be assigned if the ShapefileFeatureTable is not loaded or has previously failed to load.

      the path to the shapefile
    • close

      public void close()
      Closes the shapefile feature table.

      Before you close a shapefile feature table you should remove all references to the data it contains, such as removing the feature layer from a map and releasing the shapefile feature table. Attempts to access a shapefile feature table after it is closed will fail, resulting in an error.

      After closing a shapefile feature table, the underlying files it references can be deleted or moved.