We are pleased to introduce GeoTools 8. This presentation covers the latest and greatest developments in this OSGeo project.
GeoTools serves as a foundation for many of the exciting projects you will see here at FOSS4G. From 52N, Geomajas through to the early adopters such as GeoServer and uDig. An understanding of this core OSGeo project is an important piece in being productive in the open source Java GIS community.
With the component is such wide spread use it is important to understand how GeoTools has shifted its directions and goals as a Java library. This background information allow you to make the most of the GeoTools library at a business level. GeoTools offers a range of options for involvement allowing you to take part (even in an less formal capacity), set the direction, and participate in the release process.
Central to this presentation is an update on the new capabilities available in today's GeoTools. Key improvements, extensive new documentation, rendering capabilities and a range of extensions will be covered.
The presentation will include a quick tour of the base classes used to make integration easy and pain free, as show as they are used in the library. We also offer a sneak peek at developments in our unsupported sandbox including side by side comparisons of the gt-swing and gt-swt extensions.
If you are new to GeoTools development this is a great way to see what is available, and if you already know the project attend to keep up to date with the substantial improvements and additional capabilities available in today's GeoTools.
2. 2
About your Presenters
Andrea Aime Jody Garnett
(PMC) (PMC)
GeoSolutions LISAsoft
GeoServer/GeoTools core A great system integration
developers, raster data company helping our
management, map rendering, customers make effective use
spatial data processing of open source spatial.
3. 2
About your Presenters
Andrea Aime Jody Garnett
(PMC) (PMC)
GeoSolutions LISAsoft
GeoServer/GeoTools core A great system integration
developers, raster data company helping our
management, map rendering, customers make effective use
spatial data processing of open source spatial.
4. 3
About your Presenters
Justin Deolivera Jody Garnett
(PMC) (PMC)
OpenGeo LISAsoft
Bringing the best open source A great system integration
geospatial software to company helping our
organisations around the customers make effective use
world. of open source spatial.
9. 8
GeoTools 8
What is in a Name?
- sed/GeoTools 2.8.0/GeoTools 8.0/
What does this mean?
- not very much - business as usual
- confidence in our community
- continue our commitment to stability
- evolution handled with continuous small changes
24. Advanced Tutorials
Function
Finally a nice quick guide to how to create a function!
AbstractDataStore Tutorial - Property DataStore
The classic updated for GeoTools 8.
ContentDataStore Tutorial - CSVDataStore
The new kid on the block; leaner; meaner and ready.
Welcome
Introduction for different developer communities.
Update
Have not used GeoTools in a while? Guide to updating.
28. 25
Documentation Highlights
Details
- 291 “Pages”
- longest page is 36 pages printed out on paper
- Over 100,000 words
- Written from Feb through to May
- Accounts for every page of the wiki
New features
- Extensive FAQ
- whole project javadocs
- module by module reference
- plugins organised by module
33. 30
Vector Data Sources
• Application schema* • JDBC
• ArcSDE o DB2
• Aggregating * o H2 spatial
• CouchDb * o MySQL
• CSV * o Postgis
• DXF * o Oracle
• Excel o SQL Server
• Edigeo o Spatialite *
• PreGeneralized o Teradata *
• SimpleFeatureService *
• Shapefile (directory of)
• WFS
name* = new entry
name = “unsupported”
34. 31
JDBC DataStore "NG"
• JDBC stores:
– common base
– over 200 ready to use tests,
just prepare the test data and
run
– Parametric SQL views: define
a new data source as a raw
query
select ST_Union(the_geom) as geom
from countries
where REGION = %region%
– Extensions for native joins
35. 32
Application schema
– Complex feature support
– Recent development by CSIRO
– Feature chaining, polymorphism
– Better performance (native DBMS joins), memory use
– Usable as vector data source, GML encoding,
rendering
37. 34
Raster Data Sources
• ArcGrid • imageio-ext based
• ArcSDE o AIG
• GeoTiff o DTED
• GRASS * o ECW
• GTopo30 o EnviHdr
• Image Mosaic o ErdasImg
• Image Mosaic JDBC * o EsriHdr
• Image Pyramid o JP2 (ECW, MrSid)
• Image + World file o MrSID
• JP2 direct Kakadu o NITF*
• Matlab o RPFTOC
• Non georef. Image collection *
name * = new entry
name = unsupported land
43. 39
Layers
• FeatureLayer:
any vector + Style
(shapefile, spatial db, WFS, ...)
• GridCoverageLayer:
in memory raster grid
• GridReaderLayer:
dynamic raster read from disk
(leverage overviews and tiling)
• WMSLayer:
get maps from a WMS server
• DirectLayer: (new feature!)
roll your own custom paint method
44. 40
StyleBuilder
• Style API is inspired by SLD 1.0 and SE 1.1:
– a style is a complex, deep object graph
• StyleBuilder provides a set of hierarchical
builders
• Build a style easily, just pick the portion you need
Style style = new StrokeBuilder().color(Color.BLUE)
.width(3).dashArray(5, 2)
.buildStyle();
45. 40
StyleBuilder
• Style API is inspired by SLD 1.0 and SE 1.1:
– a style is a complex, deep object graph
• StyleBuilder provides a set of hierarchical
builders
• Build a style easily, just pick the portion you need
Style style = new StrokeBuilder().color(Color.BLUE)
.width(3).dashArray(5, 2)
.buildStyle();
46. 41
StyleBuilder
• StyleBuilder allows you to freely mix CQL
expressions
• Provides “literate” methods allowing you to
define your style using your IDE autocomplete
fts = new FeatureTypeStyleBuilder();
fts.rule().filter("pop < 200000")
.polygon().fill().colorHex("#66FF66");
fts.rule().filter("pop between 200000 and 500000")
.polygon().fill().colorHex("#33CC33");
fts.rule().filter("pop > 500000")
.polygon().fill().colorHex("#009900");
Style style = fts.buildStyle();
47. 41
StyleBuilder
• StyleBuilder allows you to freely mix CQL
expressions
• Provides “literate” methods allowing you to
define your style using your IDE autocomplete
fts = new FeatureTypeStyleBuilder();
fts.rule().filter("pop < 200000")
.polygon().fill().colorHex("#66FF66");
fts.rule().filter("pop between 200000 and 500000")
.polygon().fill().colorHex("#33CC33");
fts.rule().filter("pop > 500000")
.polygon().fill().colorHex("#009900");
Style style = fts.buildStyle();
48. 42
Showing the Map Part 1
• To start we get the data and create a Style
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource featureSource = store.getFeatureSource();
Style style = SLD.createSimpleStyle(featureSource.getSchema());
49. 43
Showing the Map Part 2
• Create Map and use JMapFrame to display
MapContent map = new MapContent();
map.setTitle("Quickstart");
Layer layer = new FeatureLayer(featureSource, style);
map.addLayer(layer);
JMapFrame.showMap(map);
50. 43
Showing the Map Part 2
• Create Map and use JMapFrame to display
MapContent map = new MapContent();
map.setTitle("Quickstart");
Layer layer = new FeatureLayer(featureSource, style);
map.addLayer(layer);
JMapFrame.showMap(map);
67. XML
Technology sax dom encode Supports
GeoTools SAX SAX DOM Filter, GML, SLD
GeoTools DOM DOM Filter, GML, SLD
GeoTools Transform XML Filter, GML, SLD
JAXB SAX DOM n/a
XDO SAX DOM XML Filter, GML, SLD, WMS, WFS1.0, XSD
(Schema Assisted
Generation 1)
GTXML SAX DOM XML Filter, GML, SLD, WMS, WFS1.0, WFS 1.1, WPS, XSD,
(Schema Assisted and more...
Generation 2)
68. 54
Schema Assisted Parsing
GeoTools Specific Technology; makes use of the schema
information to minimise the code you need to write.
You teach GeoTools how to “bind” a object once; and it will
work in any schema that uses those objects.
69. 55
Schema Assisted Encoding
The same approach is used when encoding objects;
basically using the schema as a cheat sheet to sort out what
to emit next.
71. 57
Brewer
Wraps up the ColorBrewer for Java Developers; generating
a normal Style you can use in GeoTools; or export to other
applications.
FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
groups,
ff.propertName(“population”),
colors,
"Generated Style",
schema.getGeometryDescriptor(),
StyleGenerator.ELSEMODE_IGNORE,
0.95,
stroke);
72. 57
Brewer
Wraps up the ColorBrewer for Java Developers; generating
a normal Style you can use in GeoTools; or export to other
applications.
FeatureTypeStyle style = StyleGenerator.createFeatureTypeStyle(
groups,
ff.propertName(“population”),
colors,
"Generated Style",
schema.getGeometryDescriptor(),
StyleGenerator.ELSEMODE_IGNORE,
0.95,
stroke);
73. 58
Graph
Because getting there is half the fun.
BasicLineGraphGenerator graphGen = new BasicLineGraphGenerator();
for ( MultiLineString line : lines ) {
graphGen.add( line );
}
Graph graph = graphGen.getGraph();
EdgeWeigter weighter = new EdgeWeighter() {
public double getWeight(Edge e) {
SimpleFeature feature = (SimpleFeature) e.getObject();
Geometry geometry = (Geometry) feature.getDefaultGeometry();
return gometry.getLength();
}
};
DijkstraShortestPathFinder pf =
new DijkstraShortestPathFinder( graph, start, weighter );
pf.calculate();
Path path = pf.getPath( destination );
74. Process
Close to graduating
(Maybe at the Code Sprint?)
75. Process
Annotation Based
No more filling in massive data structures; GeoTools will
generate based on annotations against a static method.
Bridge Functions and Process
Used for rendering transformations; allowing you much
greater control of geometry prior to display.
Massive influx of High Quality Processes
The full range of processes defined by GeoServer have
been back ported resulting in some of the best examples of
how to use GeoTools.
WPS Client
Still unsupported ... nothing to see here
76. 61
Process Annotation Example
Tutorial Coming soon!
@DescribeProcess(title = "Buffer", description = "Buffers a geometry using distance")
@DescribeResult(description = "The buffered geometry")
static public Geometry buffer(
@DescribeParameter(name = "geom", description = "The geometry to be buffered")
Geometry geom,
@DescribeParameter(name = "distance",
description = "The distance (same unit of measure as the geometry)")
double distance) {
return geom.buffer(distance);
}
78. 63
Application Schema
AuScope has completed their work on Application Schema.
This is an interesting module that is able to take information
from several DataStores and "map" the values into the
correct shape for publication against an application schema.
This is used when the data format used cannot be generated
and must exactly match that provided by a standards body
or expert community.
Thanks to Ben and the AuScope team for their dedication on
this very challenging problem.
80. 65
Terradata DataStore
A great bit of work from Jesse Eichar from Camptocamp.
This module went from a unsupported module through to
supported status in record time - excellent work Jesse!
82. 67
EFeature
• Kenneth Gulbrandsoy has been an amazingly
active addition to the GeoTools community.
Kenneth is a PHD student from Norwegian
University of Technology and Science.
• EFeature datastore allows teams to leverage
their Java objects into the GeoTools dynamic
feature system
• Adding Spatial capabilities to EMF models
– 98% finished
– Goal is to make it a supported plugin in GeoTools
– Docs are comming soon
84. 69
Grass Raster Reader
Andrea Antonello has pulled together support for the
GRASS raster format and donated it to the GeoTools library
(going through the effort to match our quality assurance and
documentation standards).
86. 71
Temporal
The temporal module has provided an enhanced range of
time and time range operations.
Justin has gathered this up into the gt-main module as one
of the cornerstones for WFS 2.0 Filter support.
after = ff.after(ff.property("date"),ff.literal(temporalInstant));
within = ff.toverlaps( ff.property("constructed_date"),
ff.literal(period));
88. 73
Query Improvements
Join
Justin has sorted out how Joins will be represented - finally!
Function
Between Jody and Justin Functions now have excellent runtime
documentation. Arguments are now listed by name; with specific
type information.
Filter Evaluation over a Collection
Niels (AuScope) has sorted out this one allowing you to control
how many matches are required (one, any, all) when comparing
groups of values.
Temporal
As mentioned temporal filter support has been added; seriously
increasing the number of operations available.
90. 75
Swing
The much loved gt-swing module has been used for years
to make the GeoTools tutorials visual. At long last, it is
looking to graduate to supported status.
Michael Bedward has been a
star contributor this year
cleaning up the code base,
making it testable, all the
while answering questions
on the email list.
91. 75
Swing
The much loved gt-swing module has been used for years
to make the GeoTools tutorials visual. At long last, it is
looking to graduate to supported status.
Michael Bedward has been a
star contributor this year
cleaning up the code base,
making it testable, all the
while answering questions
on the email list.
92. 76
Swing
• Major clean up of the internals!
• JMapPane rewritten
– Ported to Layer, FeatureLayer, RasterLayer etc...
– DirectLayer support for Animation / map decorations
– Nice clean background rendering
• Ability to add new InfoTool classes via plugin
• Support for Internationalisation
• Supported Status?
– Docs and Test Coverage improving by the day
• Coming Soon: Concurrent rendering
93. 77
SWT
A new addition to the project is a port of the gt-swing code to
an easy to use component for SWT.
Andrea Antonello (HydroloGIS) was responsible for this work
and it looks like gt-swing and gt-swt will be able to share the
same data models as time progresses.
95. 79
Recently Dropped
JDBCDataStore
The initial proof of concept JDBC datastore created in 2003 has
finally been replaced. We had a good 2 year deprecation cycle to
allow migration.
GeoAPI
The "opengis" interfaces have been folded back into the library
allowing us to take responsibility, improve javadocs and dive into
filter improvements for WFS 2.0 work.
Assorted Spring Cleaning
Simone was kind enough to clean out orphaned and empty
modules from out "unsupported" pile.
97. 81
Future Plans
Geometry Curves and 3D
Tisham Dhar (CSIRO) is evaluating several alternatives.
GeoTools has components of ISO 19107 provided by
SYS Technologies and the of University Fachhochschule
Koeln.
WFS 2.0 Query
Justin DeOlivera (OpenGeo) is in the middle of a
major update to DataStore query functionality
98. 82
Future RnD Ideas
OSGi Bundles
Branch started to explore this topic with contributors from several
projects.
Android
Jody had a chance to look at what it would take to port GoeTools
to Andriod. If you are interested in doing the work talk to us at the
Code Sprint.
3D
A number of teams hook GeoTools to 3D engines each year.
Indeed Oliver Gottwald plans to do so this year; anyone want to
do it as part of the community?
MIL2525B
Another classic we revisit each year - any takers?
100. 84
Upstream Projects
JTS Topology Suite (JTS)
Provides the excellent Geometry support we enjoy in
GeoTools. Thanks Martin!
imageio-ext
Provides geospatial raster formats to the Java Advanced
Imaging project we use for coverages. Thanks Simone and
GeoSolutions.
jaitools
Another extension to Java Advanced Imaging this time
thanks to Michael Bedward. Really fun for processing and
generating rasters.
102. Get Involved - Open Development
GeoTools provides clear “time boxed” procedures allowing you
to plan your community involvement.
Contribute
Clean patch + test + description = contribution
Request for Change
Open RFC procedure, time boxed allowing commit
three days after submitting (we have to meet deadlines as
well).
Release
Public release process - make a release to match your
projects schedule and deadlines.
Procedures are in place just add developers (or money).
103. Get Involved - Unsupported Area
Unsupported is a scratch pad used to work on new ideas.
Easy Commit Access
Send email and read the developers guide; a PMC member
will help you with the paper work.
Unsupported does not mean unloved
You get commit access to your module, and your work
deployed to maven nightly, and published each release.
Formal review only when Ready
Ask for a QA / Docs check at any time and graduate to a
formal supported part of the library.
I am afraid Andrea could not join us today; he has managed to break his ankle (and left me up here all alone).\n
I am afraid Andrea could not join us today; he has managed to break his ankle (and left me up here all alone).\n
GeoTools *is* the Java GIS Toolkit :-)\n\nWell at least it is happy to trace its roots back to the dawn of the JVM.\n\nGeoTools 1.0 &#xA0;was started at Leeds University by James&#xA0;Macgill and Ian Turton&#xA0;in 1996.\n\nThe codebase was reset in 2003 with an influx of code from the SEAGIS project and a project management committee setup.\n\nWe have had a steady series of releases since then:\n\nThe Geotools 1.0 Lite Project (1996 - 2003)\nGeotools 2.0 Project (2002 to&#xA0;Geotools 2.1 (2004 to 2005)\n2004)\nGeotools 2.2 (2005)\nGeoTools 2.3 (2005-2007)\nGeoTools 2.4 (2006-2007)\nGeoTools 2.5 (2007)\nGeoTools 2.6 (2008)\nGeoTools 2.7 (2009 - Present)&#xA0;GeoTools 8 (unreleased)&#xA0;\n
GeoTools today is well represented with ten organisations actively participating.\n\nMore importantly you can see a number of names marked with "?" - these individuals are new to GeoTools and are often working on RnD activities in our&#xA0;"unsupported" sandbox.\n
This graph shows a very active project with many issues being reported; and the developers doing the best to keep up.\n\nYou can really notice a few spikes as development teams try out the library from armed with a different application or dataset in mind.\n\nClick on the link to see an update of the chart provided (additional charts are available if you login to the issue tracker).\n
Documentation is the key feature this year!\n\nReally :-)\n
This really is the "GeoTools 2" project finally taking over and being the "GeoTools" project.\n\nWe have averaged one release ever year or so. Making "Version 8" a clear indication of where the project is at with respect to maturity and stability.\n
Documentation is the key feature this year!\n\nReally :-)\n
Since 2003 GeoTools has employed a &#x201C;wiki&#x201D; to capture user documentation.\n
In 2009 we set up our main website using &#x201C;Sphinx&#x201D;\nin 2010 Jody ported the tutorials from open office to Sphinx.\nIn 2011 Jody finished the Job.\n
In 2009 we set up our main website using &#x201C;Sphinx&#x201D;\nin 2010 Jody ported the tutorials from open office to Sphinx.\nIn 2011 Jody finished the Job.\n
The wiki was a great way to pass around small java code examples.\n\nDid they compile? Not really. Could you tell when they were written? Or what version of GeoTools they worked on?\n\nOnce again no.\n
The wiki was a great way to pass around small java code examples.\n\nDid they compile? Not really.\n\nCould you tell when they were written? Or what version of GeoTools they worked on?\n\nOnce again no.\n
The wiki was a great way to pass around small java code examples.\n\nDid they compile? Not really.\n\nCould you tell when they were written? Or what version of GeoTools they worked on?\n\nOnce again no.\n
\n
This is the origional diagram made for a presentation at FOSS4G 2006 (Done in Viso so nobody could really edit it)\n
All diagrams are now done in SVG using Inkscape (so that any developer can update them as needed).\n
Class diagrams were uploaded to the wiki using a range of tools.&#xA0;\n\nThis often allowed the class diagrams to fall behind the current state of the library - providing oppertunity for confusion.\n
Class diagrams are created using "ObjectAID" directly from the java classes or interfaces involved.\n\nThe diagrams are committed directly into source code and are&#xA0;set to&#xA0;automatically&#xA0;generate the PNG file used in the documentations if they are modified.\n\nThis allows us to give you accurate and up to date diagrams.\n
In the past the creation of Tutorials for GeoTools was a bit add-hoc.\n\nBasically when Jody Got a workshop accepted at FOSS4G.\n\nThese would also gradually go out of date. As the versions of Java, Maven and Eclipse used changed over time.\n
Tutorials now documented in "sphinx" giving us a chance to splice in live code examples that do not go out fo date.\n\nOrigional done for FOSS4G 2010 their long term stability showed the viability of using Sphinx for GeoTools.\n
\n
Extensive welcome section\n
\n
\n
\n
\n
Andrea has been working hard on referencing; as you can see he really believes in this being a developer friendly presentation - with source code examples!\n\nThe key thing about &#x201C;referencing&#x201D; information is the rich set of data structures used to mark down what your information should be used; and the helpful way we have isolated you from the internal details (ie Math) using utility classes such as CRS, JTS and ReprojectingFeatureCollection.\n
A quick list of some of the traditional projects available to GeoTools developers.\n
\n
The important part here is to note the number of new entries being added to GeoTools.\n\nItems marked in grey are considered unsupported (often they are an experiment; or represent code that does not have an active maintenance contract).\n
\n
\n
\n
\n
\n
\n
\n
\n
The number of layers you can work with is now &#x201C;open ended&#x201D; with the ability to define your own implementation of &#x201C;Direct Layer&#x201D;. This class hierarchy is an improvement in that each kind of layer is represented a distinct class.\n
\n
\n
\n
\n
The ability to define your own symbology and &#x201C;plug&#x201D; it into the rendering engine is really being taken advantage of in GeoTools. Here we have a quick example of using a true type font.\n
The feature is often used by teams implementing MIL2525B symbology. A popular example from the GeoServer cookbook is the &#x201C;Slash&#x201D; shown above.\n
All of this is backed by a Java interface so can connect the geotools renderer to any set of symbology you have in your possession; or create a symbol dynamically on the fly by accessing feature attributes.\n
Another feature that is starting to gain traction is the use of functions to transform a geometry prior to display. In this example the technique is used to create arrow heads.\n\n
Another example used to create a drop shadow effect; by offsetting the geometry.\n
You can create a function quickly as shown above; you need to &#x201C;Register&#x201D; it in META-INF/services by adding the name of your class to the appropriate text file.\n
\n
\n
\n
If you would like to read more try the FAQ http://docs.geotools.org/latest/userguide/library/xml/faq.html\n
Check out the GeoTools docs for a tutorial coming soon!\n
\n
We mentioned this one earlier!\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Part of keeping GeoTools in fighting shape is cutting off the cruft.\n\nWe have been diligent about allowing full deprecation cycle allowing projects to transition to the JDBC "next generation" datastore based on a much cleaner design.\n