GeoTools : Data access basic

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:

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.


DataSource.gif (image/gif)
Expression.gif (image/gif)
Filter.gif (image/gif)
DataStoreRead.gif (image/gif)
DataStoreWrite.gif (image/gif) (text/x-java) (text/x-java) (text/x-java)


Is the "LineString" on this page from com.vividsolutions.jts.geom.LineString
or org.geotools.renderer.geom.LineString or oracle.sdoapi.geom.LineString?

Posted by kenhtanaka at Oct 14, 2004 16:32

The old sample uses the class com.vividsolutions.jts.geom.LineString.

Posted by ekyu88 at Oct 27, 2004 22:41