Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update docs, remove references to the indexed shapefile store, fix us…

…age of long winded constructors
  • Loading branch information...
commit d67d4d2b871dd4c06f8c7303a5cda4e318114e48 1 parent c951a61
@aaime aaime authored
View
48 docs/user/library/data/datastore.rst
@@ -89,20 +89,10 @@ These examples bring up a couple of questions:
We are using a FactoryFinder (rather than just saying new
ShapefileDataStore ) so GeoTools can have a look at your specific
- fiel choose the right implementation for the job.
-
- Currently GeoTools has two implementations:
-
- * ShapefileDataStore
-
- Provided by **ShapefileDataStoreFactory** for direct access to a
- shapefile, suitable for shapefiles located on network shares and web
- services
-
- * IndexedShapefileDataStore
-
- Provided by **IndexedShapefileDataStoreFactory** to makes use of
- (or create) a spatial index for fast access
+ configuration and choose the right implementation for the job.
+ Store implementation might change in time, accessing the stores via the
+ factory ensures your client code does not need to be changed when this happens.
+
* Q: What do we put it the Map?
@@ -110,7 +100,6 @@ These examples bring up a couple of questions:
* :doc: `shape` (user guide)
* `ShapefileDataStoreFactory <http://docs.geotools.org/stable/javadocs/org/geotools/data/shapefile/ShapefileDataStoreFactory.html>`_ (javadocs)
- * `IndexedShapefileDataStoreFactory <http://docs.geotools.org/stable/javadocs/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreFactory.html>`_ (javadocs)
This information is also available at runtime via the
**DataStoreFactorySpi,getParameterInfo()** method. You can use this
@@ -170,12 +159,12 @@ You can also dodge the FactoryFinder and make use of the following quick hacks.
This is not wise (as the implementation may change over time) but here is how it is done.
-* Use new ShapefileDataStore::
+* Use ShapefileDataStore::
File file = new File("example.shp");
- URI namespace = new URI("refractions");
- boolean useMemoryMapped = true;
- DataStore shapefile = new ShapefileDataStore( example.toURL(), namespace, useMemoryMapped );
+ DataStore shapefile = new ShapefileDataStore( example.toURL());
+ shapefile.setNamespace(new URI("refractions"));
+ shapefile.setMemoryMapped(true ;
String typeName = shapefile.getTypeName(); // should be "example"
FeatureType schema = shapefile.getSchema( typeName ); // should be "refractions.example"
@@ -188,26 +177,9 @@ This is not wise (as the implementation may change over time) but here is how it
application can we ask you to use the DataStoreFactoryFinder. It will
let the library sort out what implementation is appropriate.
-* Use new IndexedShapefileDataStore::
-
- File file = new File("example.shp");
- URI namespace = new URI("refractions");
- boolean memoryMapped = true;
- boolean createIndex = true;
- byte treeType = IndexedShapefileDataStore.TREE_QIX;
-
- DataStore shapefile = new IndexedShapefileDataStore( example.toURL(), namespace, memoryMapped, createIndex, treeType );
-
- String typeName = shapefile.getTypeName(); // should be "example"
- ...
-
- This hack may be fine for a quick code example, but in a real
- application can we ask you to use the DataStoreFactoryFinder. It will
- let the library sort out what implementation is appropriate.
-
-* Use IndexedShapefileDataStoreFactory::
+* Use ShapefileDataStoreFactory::
- FileDataStoreFactorySpi factory = new IndexedShapefileDataStoreFactory();
+ FileDataStoreFactorySpi factory = new ShapefileDataStoreFactory();
File file = new File("example.shp");
Map map = Collections.singletonMap( "url", file.toURL() );
View
17 docs/user/library/data/shape.rst
@@ -34,9 +34,22 @@ The following connection parameters are available:
| "charset" | Optional: Chartset used to decode strings in the |
| | DBF file |
+-------------------------+----------------------------------------------------+
-| "timezone | Optional: Timezone used to parse dates in the |
+| "timezone" | Optional: Timezone used to parse dates in the |
| | DBF file |
+-------------------------+----------------------------------------------------+
+| "memory mapped buffer" | Optional: memory map the files (unadvisable for |
+| | large files under windows, defaults to false) |
++------------------------------------------------------------------------------+
+| "cache memory maps" | Optional: when memory mapping, cache and reuse |
+| | memory maps (defaults to true) |
++------------------------------------------------------------------------------+
+| "create spatial index" | Optional: if false, won't try to create a spatial |
+| | index if missing (defaults to true) |
++------------------------------------------------------------------------------+
+| "enable spatial index" | Optional: if false, the spatial index won't be used|
+| | even if available (and won't be created if missing |
++-------------------------+----------------------------------------------------+
+
This information is also in the `javadocs <http://docs.geotools.org/latest/javadocs/org/geotools/data/shapefile/ShapefileDataStoreFactory.html>`_ .
@@ -134,7 +147,7 @@ Supports:
Limitations:
-* only work with MultiLineStirngs, MultiPolygon or MultiPoint. GIS data often travels
+* only work with MultiLineStrings, MultiPolygon or MultiPoint. GIS data often travels
in herds - so being restricted to the plural form is not a great limitation.
* only work with fixed length strings (you will find the FeatureType
has a restriction to help you check this, and warnings will be produced if
View
2  docs/user/library/main/internal.rst
@@ -28,7 +28,7 @@ And a couple that are no longer used:
AbstractDataStore
^^^^^^^^^^^^^^^^^
-The **AbstractDataStore** is the super class for ShapefileDataStore and the legacy JDBC DataStores.
+The **AbstractDataStore** is an old base class for DataStore implementations, currently used only by MemoryDataStore and PropertyDataStore. All new stores use **ContentDataStore** instead.
.. image:: /images/AbstractDataStore.PNG
View
12 docs/user/welcome/use.rst
@@ -129,8 +129,7 @@ Bad practice with direct dependency on ShapeFileDataStoreFactory::
ShapeFileDataStore = factory.createDataStore( file );
This code example would have been fine for GeoTools 2.1, however for GeoTools 2.2 an "indexed"
-shapefile datastore was created with far better performance. The factory would be smart enough
-to create an IndexedShapeFileDataStore if an index file was available.
+shapefile datastore was created with far better performance.
Here is a replacement that allows GeoTools to return an indexed datastore if one is available::
@@ -365,7 +364,7 @@ Sometimes you just need to go ahead and code it like you mean it. The GeoTools p
You can just use a specific factory that is known to you::
- DataStoreFactorySpi factory = new IndexedShapefileDataStoreFactory();
+ DataStoreFactorySpi factory = new ShapefileDataStoreFactory();
File file = new File("example.shp");
Map map = Collections.singletonMap( "url", file.toURL() );
@@ -394,11 +393,12 @@ You can skip the whole Factory madness and just do normal Java coding::
File file = new File("example.shp");
URI namespace = new URI("refractions");
- boolean useMemoryMapped = true;
- ShapefileDataStore shapefile = new ShapefileDataStore( example.toURL(), namespace, useMemoryMapped );
+ ShapefileDataStore shapefile = new ShapefileDataStore( example.toURL());
+ shapefile.setNamespace(namespace);
+ shapefile.setMemoryMapped(true);
You are depending on a exact class here, violating the plug-in system and so on. Chances are that GeoTools should not let you do this (by making the constructor package visible and forcing you to use the associated DataStoreFactory instead).
-This option is fine for quick hacks, you may find that the ShapefileDataStore has additional methods (to handle such things as forcing the "prj" file to be rewritten.::
+This option is fine for quick hacks, you may find that the ShapefileDataStore has additional methods (to handle such things as forcing the "prj" file to be rewritten)::
shapefile.forceSchemaCRS( CRS.decode( "EPSG:4326" ) );
Please sign in to comment.
Something went wrong with that request. Please try again.