Class OGRDataStore

Object
ContentDataStore
OGRDataStore
All Implemented Interfaces:
DataAccess<SimpleFeatureType,SimpleFeature>, DataStore

public class OGRDataStore extends ContentDataStore
A data store based on the OGR native library
Author:
Andrea Aime - GeoSolutions
  • Constructor Details

  • Method Details

    • createTypeNames

      protected List<Name> createTypeNames() throws IOException
      Description copied from class: ContentDataStore
      Creates a set of qualified names corresponding to the types that the datastore provides.

      Namespaces may be left null for data stores which do not support namespace qualified type names.

      Specified by:
      createTypeNames in class ContentDataStore
      Returns:
      A list of Name.
      Throws:
      IOException - Any errors occuring connecting to data.
    • createFeatureSource

      protected ContentFeatureSource createFeatureSource(ContentEntry entry) throws IOException
      Description copied from class: ContentDataStore
      Instantiates new feature source for the entry.

      Subclasses should override this method to return a specific subclass of ContentFeatureSource.

      Specified by:
      createFeatureSource in class ContentDataStore
      Parameters:
      entry - The entry.
      Returns:
      An new instance of ContentFeatureSource for the entry.
      Throws:
      IOException
    • supportsInPlaceWrite

      public boolean supportsInPlaceWrite(String typeName) throws IOException
      Throws:
      IOException
    • createSchema

      public void createSchema(SimpleFeatureType schema) throws IOException
      Description copied from class: ContentDataStore
      Creates a new schema in the datastore.

      This implementation throws aUnsupportedOperationException. Subclasses should override to support schema creation.

      Specified by:
      createSchema in interface DataAccess<SimpleFeatureType,SimpleFeature>
      Overrides:
      createSchema in class ContentDataStore
      Parameters:
      schema - FetureType to add to DataStore
      Throws:
      IOException - If featureType cannot be created
      See Also:
    • createSchema

      public void createSchema(SimpleFeatureType schema, boolean approximateFields, String[] options) throws IOException
      Creates a new OGR layer with provided schema and options
      Parameters:
      schema - the geotools schema
      approximateFields - if true, OGR will try to create fields that are approximations of the required ones when an exact match cannt be provided
      options - OGR data source/layer creation options
      Throws:
      IOException
    • createSchema

      public void createSchema(SimpleFeatureCollection data, boolean approximateFields, String[] options) throws IOException
      Creates a new OGR layer with provided data and options. This call is specifically made available for the OGC store since for some data source types, such as GML or KML, it is not possible to call createSchema() independently from a write, as the result will not contain the schema definition without having data too. Also, in those formats, the output is writable only so as long as it's empty, it's not possible to write against an existing GML file for example.
      Parameters:
      data - The data to fill into the newly created layer
      approximateFields - if true, OGR will try to create fields that are approximations of the required ones when an exact match cannt be provided
      options - OGR data source/layer creation options
      Throws:
      IOException
    • dispose

      public void dispose()
      Description copied from interface: DataAccess
      Disposes of this data store and releases any resource that it is using.

      A DataStore cannot be used after dispose has been called, neither can any data access object it helped create, such as FeatureReader, FeatureSource or FeatureCollection.

      This operation can be called more than once without side effects.

      There is no thread safety assurance associated with this method. For example, client code will have to make sure this method is not called while retrieving/saving data from/to the storage, or be prepared for the consequences.

      Specified by:
      dispose in interface DataAccess<SimpleFeatureType,SimpleFeature>
      Overrides:
      dispose in class ContentDataStore