edu.ucsb.nceas.metacat.spatial

## Class SpatialDataset

- java.lang.Object
- - edu.ucsb.nceas.metacat.spatial.SpatialDataset

-     public class SpatialDataset
      extends java.lang.Object

  Class providing direct read/write access to the persistent spatial cache.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpatialDataset()` empty constructor for SpatialDataset

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(java.lang.String geomType, org.opengis.feature.simple.SimpleFeature feature)` Adds a new feature (from a SpatialDocument) This is faster than insertOrUpdate but relying on this method might cause duplication of docids in the spatial cache.
    `void` | `delete(java.lang.String geomType, java.lang.String docid)` Deletes given docid from the spatial cache.
    `void` | `insertOrUpdate(java.lang.String geomType, org.opengis.feature.simple.SimpleFeature feature, java.lang.String docid)` Either inserts or updates the spatial cache with the new spatial document depending on if it currently exists.
    `void` | `save()` Saves the SpatialDataset object to the spatial cache.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SpatialDataset

          public SpatialDataset()
                         throws java.io.IOException

      empty constructor for SpatialDataset
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### add

          public void add(java.lang.String geomType,
                          org.opengis.feature.simple.SimpleFeature feature)

      Adds a new feature (from a SpatialDocument) This is faster than insertOrUpdate but relying on this method might cause duplication of docids in the spatial cache. Therefore, its really only useful when regenerating the entire cache.
      Parameters:
        `geomType` - The kind of feature to be added. Currently "polygon" and "point" supported.
        `feature` - The geotools feature to be added to the spatial cache.

    - #### delete

          public void delete(java.lang.String geomType,
                             java.lang.String docid)
                      throws java.io.IOException

      Deletes given docid from the spatial cache.
      Parameters:
        `geomType` - The kind of feature to be added. Currently "polygon" and "point" supported.
        `docid` - The document to be deleted from the spatial cache.
      Throws:
        `java.io.IOException`

    - #### insertOrUpdate

          public void insertOrUpdate(java.lang.String geomType,
                                     org.opengis.feature.simple.SimpleFeature feature,
                                     java.lang.String docid)
                              throws java.io.IOException

      Either inserts or updates the spatial cache with the new spatial document depending on if it currently exists. Docid is also passed in for quicker searching.
      Parameters:
        `geomType` - The kind of feature to be added. Currently "polygon" and "point" supported.
        `feature` - The geotools feature to be added to the spatial cache.
        `docid` - The document id to be inserted or updated. Used to filter for existing features.
      Throws:
        `java.io.IOException`

    - #### save

          public void save()

      Saves the SpatialDataset object to the spatial cache.

Copyright © 2020 Regents of the University of California. All Rights Reserved.