Snippets are small, incomplete code samples demonstrating a specific feature of Geotools or a particular method to use the library. These samples are especially useful to document complex issues of the library. These samples do not have to be fully developed to be useful.
|
Existing snippets may not work with all versions of Geotools. We are working, in the summer of 2006, to clarify which version each example targets. |
New users should look initially at the User Manual or the Tutorials, since those examples are presented with more context and with full source code.
|
Feel free to add a new snippet if you discover a new way to use the library. However, please be sure to document the release version number of Geotools for which your snippet was created. |
Geometry
Georeferencing and Coordinate Transformations
Features
- CreateAFeatureType
- CreateAFeatureCollection
- How to create a simple FeatureCollection from Scratch
- SerializableFeatures
- FeatureCache- Class that provides the ability to cache all Features in a FeatureSource and then provide random access to them based on the value of an attribute.
Datastore Snippets
- ShapeReaderWriter
- ShapeReprojector
- PostGISDataStore - a PostGISDataStore created with a DataStoreFinder
- MySQLDataStore - a MySQL example
- WFSDataStore - a WFSDataStore
- GMLDataStore
- AddDataInMySQL
- MySQLConnectionClass
- MIFDataStore - The MapInfo MIF format datastore
- DB2DataStore - A DataStore for DB2
- ArcSDE snippets - SDE connection example
Grids
Filters
- SimpleMathExpression
- How to use a Compare Filter
- Using a bounding box Filter
- SimpleFileFilter
- Create a Filter from XML
- Create filter from String
- BetweenFilter
Rendering
Styles
- SimpleSLD
- MarkTestSLD
- TextTestSLD
- ExternalGraphicsSLD
- ExternalGraphicsJava
- SerializationConsiderations
Geotools 2.1 and 2.0 Snippets
These snippets use an older georeferencing system which was deprecated in 2.1 and removed in 2.2. These examples, therefore, will not work with recent releases of Geotools. These Map and GUI widgets classes no longer exist in the code released by the project but these examples illustrate how to connect the library to on screen entities.