This basic tutorial is meant to get you started with the data access features that Geotools2 provides. It is intended for people wanting to learn the basics of data access such as reading and writing shapefiles, performing attribute queries or spatial queries. If you need to create your own data stores, read the more comprehensive 0 Introducing PropertyDataStore.
This tutorial uses the ShapefileDataStore as an example data store. The following how to's extend this to other data stores:
- How to use a PostGISDataStore - a PostGISDataStore created with a DataStoreFinder
- How to run the Spearfish example with MySQL - a MySQL example
- How to run the Spearfish example with DB2
- Use of another databases like HSQLDB or Derby
As you may know, the GIS field developed a wide variety of different ways to manage and store data. Some of these differences are structural, like the data modelling between raster and vector data, or between topological and non-topological vector data handling. Others relate to data management, such as the difference between file based formats and spatially enabled databases. Finally some more mundane differences arise from the different file formats for vector data.
Since Geotools is a library, we try to provide interfaces that abstract all the common aspects of data management and access, leaving only the differences related to conceptual data management.
Following this principle, Geotools supports non-topological vector data according to the OpenGIS simple feature specification by means of the DataStore and Feature interfaces. Raster data is accessed with the GridCoverageExchange to produce OpenGIS Grid Coverages . Topological vector data and TIN are not supported at present, but will be introduced in the future when we implement the GeoAPI interfaces .
In this tutorial we will concentrate our attention on non-topological vector data access using the DataStore interface. For raster data access and manipulation see the Using Grid Coverage Exchange.