|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.data.AbstractDataStore
org.geotools.data.AbstractFileDataStore
org.geotools.data.shape.ShapefileDataStore
A DataStore implementation which allows reading and writing from Shapefiles.
Nested Class Summary | |
protected static class |
ShapefileDataStore.Reader
An AttributeReader implementation for shape. |
protected class |
ShapefileDataStore.Writer
A FeatureWriter for ShapefileDataStore. |
Field Summary |
Fields inherited from class org.geotools.data.AbstractDataStore |
isWriteable, listenerManager, LOGGER |
Constructor Summary | |
ShapefileDataStore(java.net.URL url)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
boolean useMemoryMappedBuffer)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
boolean useMemoryMappedBuffer,
boolean createIndex)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
boolean useMemoryMappedBuffer,
boolean createIndex,
boolean useIndex)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
java.net.URI namespace)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
java.net.URI namespace,
boolean useMemoryMappedBuffer)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
java.net.URI namespace,
boolean useMemoryMappedBuffer,
boolean createIndex)
Creates a new instance of ShapefileDataStore. |
|
ShapefileDataStore(java.net.URL url,
java.net.URI namespace,
boolean useMemoryMappedBuffer,
boolean createIndex,
boolean useIndex)
Creates a new instance of ShapefileDataStore. |
Method Summary | |
protected FeatureReader |
createFeatureReader(java.lang.String typeName,
ShapefileDataStore.Reader r,
FeatureType readerSchema)
|
protected java.lang.String |
createFeatureTypeName()
Create the type name of the single FeatureType this DataStore represents. |
void |
createSchema(FeatureType featureType)
Set the FeatureType of this DataStore. |
protected ShapefileDataStore.Reader |
getAttributesReader(boolean readDbf,
Filter filter)
Returns the attribute reader, allowing for a pure shape reader, or a combined dbf/shp reader. |
protected com.vividsolutions.jts.geom.Envelope |
getBounds(Query query)
Computes the bounds of the features for the specified feature type that satisfy the query provided that there is a fast way to get that result. |
protected int |
getCount(Query query)
Gets the number of the features that would be returned by this query for the specified feature type. |
protected java.lang.String |
getCurrentTypeName()
|
protected FeatureReader |
getFeatureReader()
Singular version, which must be implemented to represent a Reader for the url being read. |
protected FeatureReader |
getFeatureReader(java.lang.String typeName)
Create a FeatureReader for the provided type name. |
protected FeatureReader |
getFeatureReader(java.lang.String typeName,
Query query)
Use the spatial index if available and adds a small optimization: if no attributes are going to be read, don't uselessly open and read the dbf file. |
FeatureSource |
getFeatureSource(java.lang.String typeName)
Default implementation based on getFeatureReader and getFeatureWriter. |
protected FeatureWriter |
getFeatureWriter(java.lang.String typeName)
Create a FeatureWriter for the given type name. |
FeatureType |
getSchema()
Singular version, returns the FeatureType for the url being read. |
FeatureType |
getSchema(java.lang.String typeName)
Obtain the FeatureType of the given name. |
java.lang.String[] |
getTypeNames()
Get an array of type names this DataStore holds. |
boolean |
isLocal()
Determine if the location of this shape is local or remote. |
protected DbaseFileReader |
openDbfReader()
Convenience method for opening a DbaseFileReader. |
protected IndexFile |
openIndexFile()
Convenience method for opening a ShapefileReader. |
protected PrjFileReader |
openPrjReader()
Convenience method for opening a DbaseFileReader. |
protected QuadTree |
openQuadTree()
Convenience method for opening a QuadTree index. |
protected RTree |
openRTree()
Convenience method for opening an RTree index. |
protected ShapefileReader |
openShapeReader()
Convenience method for opening a ShapefileReader. |
protected AttributeType[] |
readAttributes()
Create the AttributeTypes contained within this DataStore. |
protected void |
typeCheck(java.lang.String requested)
A convenience method to check if a type name is correct. |
Methods inherited from class org.geotools.data.AbstractFileDataStore |
getFeatureSource, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, updateSchema |
Methods inherited from class org.geotools.data.AbstractDataStore |
createContents, createLockingManager, createMetadata, createTypeEntry, entries, fireAdded, fireChanged, fireRemoved, getFeatureReader, getFeatureWriter, getFeatureWriter, getFeatureWriterAppend, getLockingManager, getUnsupportedFilter, getView, search, updateSchema |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ShapefileDataStore(java.net.URL url) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.
java.net.MalformedURLException
- If computation of related URLs
(dbf,shx) fails.public ShapefileDataStore(java.net.URL url, java.net.URI namespace) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.
java.net.MalformedURLException
- If computation of related URLs
(dbf,shx) fails.public ShapefileDataStore(java.net.URL url, java.net.URI namespace, boolean useMemoryMappedBuffer) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.useMemoryMappedBuffer
- enable/disable memory mapping of files
java.net.MalformedURLException
public ShapefileDataStore(java.net.URL url, boolean useMemoryMappedBuffer) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.useMemoryMappedBuffer
- enable/disable memory mapping of files
java.net.MalformedURLException
public ShapefileDataStore(java.net.URL url, boolean useMemoryMappedBuffer, boolean createIndex) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.useMemoryMappedBuffer
- enable/disable memory mapping of filescreateIndex
- enable/disable automatic index creation if needed
java.net.MalformedURLException
public ShapefileDataStore(java.net.URL url, java.net.URI namespace, boolean useMemoryMappedBuffer, boolean createIndex) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.useMemoryMappedBuffer
- enable/disable memory mapping of filescreateIndex
- enable/disable automatic index creation if needed
java.net.MalformedURLException
public ShapefileDataStore(java.net.URL url, boolean useMemoryMappedBuffer, boolean createIndex, boolean useIndex) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.useMemoryMappedBuffer
- enable/disable memory mapping of filescreateIndex
- enable/disable automatic index creation if neededuseIndex
- enable/disable index usage (mainly for testing)
java.net.MalformedURLException
public ShapefileDataStore(java.net.URL url, java.net.URI namespace, boolean useMemoryMappedBuffer, boolean createIndex, boolean useIndex) throws java.net.MalformedURLException
url
- The URL of the shp file to use for this DataSource.useMemoryMappedBuffer
- enable/disable memory mapping of filescreateIndex
- enable/disable automatic index creation if neededuseIndex
- enable/disable index usage (mainly for testing)
java.net.MalformedURLException
Method Detail |
public boolean isLocal()
protected FeatureReader getFeatureReader(java.lang.String typeName) throws java.io.IOException
getFeatureReader
in class AbstractDataStore
typeName
- The name of the FeatureType to create a reader for.
java.io.IOException
- If an error occurs during creation
DataSourceException
- DOCUMENT ME!protected FeatureReader getFeatureReader() throws java.io.IOException
AbstractFileDataStore
getFeatureReader
in class AbstractFileDataStore
java.io.IOException
org.geotools.data.DataStore#getFeatureReader(java.lang.String)
protected FeatureReader getFeatureReader(java.lang.String typeName, Query query) throws java.io.IOException
getFeatureReader
in class AbstractDataStore
java.io.IOException
AbstractDataStore.getFeatureReader(java.lang.String, org.geotools.data.Query)
protected FeatureReader createFeatureReader(java.lang.String typeName, ShapefileDataStore.Reader r, FeatureType readerSchema) throws SchemaException, java.io.IOException
typeName
- r
- readerSchema
-
SchemaException
java.io.IOException
protected ShapefileDataStore.Reader getAttributesReader(boolean readDbf, Filter filter) throws java.io.IOException
readDbf
- - if true, the dbf fill will be opened and readfilter
- - a Filter to use
java.io.IOException
protected IndexFile openIndexFile() throws java.io.IOException
java.io.IOException
protected ShapefileReader openShapeReader() throws java.io.IOException
java.io.IOException
- If an error occurs during creation.
DataSourceException
- DOCUMENT ME!protected DbaseFileReader openDbfReader() throws java.io.IOException
java.io.IOException
- If an error occurs during creation.protected PrjFileReader openPrjReader() throws java.io.IOException, org.opengis.referencing.FactoryException
java.io.IOException
- If an error occurs during creation.
org.opengis.referencing.FactoryException
protected RTree openRTree() throws java.io.IOException
java.io.IOException
- If an error occurs during creation.
DataSourceException
- DOCUMENT ME!protected QuadTree openQuadTree() throws StoreException
StoreException
public java.lang.String[] getTypeNames()
getTypeNames
in interface DataStore
getTypeNames
in class AbstractDataStore
protected java.lang.String createFeatureTypeName()
protected java.lang.String getCurrentTypeName()
protected void typeCheck(java.lang.String requested) throws java.io.IOException
requested
- The type name requested.
java.io.IOException
- If the type name is not availableprotected FeatureWriter getFeatureWriter(java.lang.String typeName) throws java.io.IOException
getFeatureWriter
in class AbstractDataStore
typeName
- The typeName of the FeatureType to write
java.io.IOException
- If the typeName is not available or some other error
occurs.public FeatureType getSchema(java.lang.String typeName) throws java.io.IOException
getSchema
in interface DataStore
getSchema
in class AbstractDataStore
typeName
- The name of the FeatureType.
java.io.IOException
- If a type by the requested name is not present.
DataSourceException
- DOCUMENT ME!public FeatureType getSchema() throws java.io.IOException
AbstractFileDataStore
getSchema
in class AbstractFileDataStore
java.io.IOException
DataStore.getSchema(java.lang.String)
protected AttributeType[] readAttributes() throws java.io.IOException
java.io.IOException
- If AttributeType reading failspublic void createSchema(FeatureType featureType) throws java.io.IOException
createSchema
in interface DataStore
createSchema
in class AbstractDataStore
featureType
- The desired FeatureType.
java.io.IOException
- If the DataStore is remote.protected com.vividsolutions.jts.geom.Envelope getBounds(Query query) throws java.io.IOException
AbstractDataStore
Will return null if there is not fast way to compute the bounds. Since it's based on some kind of header/cached information, it's not guaranteed to be real bound of the features
getBounds
in class AbstractDataStore
query
-
java.io.IOException
AbstractDataStore.getBounds(org.geotools.data.Query)
public FeatureSource getFeatureSource(java.lang.String typeName) throws java.io.IOException
AbstractDataStore
We should be able to optimize this to only get the RowSet once
getFeatureSource
in interface DataStore
getFeatureSource
in class AbstractDataStore
java.io.IOException
DataStore.getFeatureSource(java.lang.String)
protected int getCount(Query query) throws java.io.IOException
AbstractDataStore
If getBounds(Query) returns -1
due to expense consider
using getFeatures(Query).getCount()
as a an alternative.
getCount
in class AbstractDataStore
query
- Contains the Filter and MaxFeatures to find the bounds for.
-1
if count is too expensive to calculate or any errors or occur.
java.io.IOException
AbstractDataStore.getCount(org.geotools.data.Query)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |