ShapefileFeatureTable Class

  • ShapefileFeatureTable
  • class Esri::ArcGISRuntime::ShapefileFeatureTable

    A table of features that typically represents real-world objects created from a local shapefile data source. More...

    Header: #include <ShapefileFeatureTable.h>
    Since: Esri::ArcGISRuntime 100.2
    Inherits: Esri::ArcGISRuntime::FeatureTable

    Public Functions

    ShapefileFeatureTable(const QString &path, QObject *parent = nullptr)
    virtual ~ShapefileFeatureTable() override
    void close()
    Esri::ArcGISRuntime::ShapefileInfo info() const
    bool isSpatialIndexEnabled() const
    QString path() const

    Detailed Description

    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.

    Member Function Documentation

    [explicit] ShapefileFeatureTable::ShapefileFeatureTable(const QString &path, QObject *parent = nullptr)

    Creates a shapefile feature table from the local shapefile (.shp) at the given path.

    • path - Path to the .shp shape file.
    • parent - The optional parent QObject.

    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.

    [override virtual] ShapefileFeatureTable::~ShapefileFeatureTable()

    Destructor.

    [since Esri::ArcGISRuntime 100.3] void ShapefileFeatureTable::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.

    This function was introduced in Esri::ArcGISRuntime 100.3.

    Esri::ArcGISRuntime::ShapefileInfo ShapefileFeatureTable::info() const

    Returns 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 nullptr.

    bool ShapefileFeatureTable::isSpatialIndexEnabled() const

    Returns 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.

    QString ShapefileFeatureTable::path() const

    Returns 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.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.