Skip to content

geospatial for java tutorial

Jody Garnett edited this page Apr 11, 2015 · 5 revisions

Michael Bedward and Jody Garnett are putting on a GeoTools tutorial at FOSS4G 2009; this is a checklist of the tutorial content and progress made.

✅ done ❎ needs testing ⛔ stuck

To help out please email Michael Bedward or Jody Garnett and we can send you a draft of one of the tutorials to test. We would really love feedback on the document and on the API for style / MapContext / JMapPane.

We will try and encoroprate these tutorials into the website after FOSS4G - until then sending and email and volunteering to give us feedback is the only way to get these docs.

Document

Code

Tested

Document

Review

#NetBeans Quickstart

#Eclipse Quickstart

#CSV2SHP

#GeometryCRS

#Filter

#ImageLab

#Style

✅ okay ⚠️ work in progress ⛔ work stopped

Quickstart

API changes:

  • FileDataStore interface created in order to prevent dependency on AbstractFileDataStore
  • TypeNarrowed FileDataStoreFactorySPI to return a FileDataStore
  • Removed need for MapContext to be configured with a CRS (it will now take it from the first layer with a crs provided)
  • Allowed addLayer to take a null Style; a default will be created based on feature type

NetBeans Quickstart

Covers setting up with jars from geotools download; and using maven.

Eclipse Quickstart

Covers setting up with jars from geotools download; and using command line maven.

Goals - get something on screen quickly with the minimum number of lines of code. We have taken a minimal "shapelab"

CSV2SHP

This is now out second example; and the first introduction to Feature and FeatureType. This is now a very important tutorial as it serves as an introduction to the data model.

We hope that this will be a better introduction then reading a shapefile; as it is easier to understand the data model when building things up that you created yourself.

This is also nice in that they can use the Quickstart to view the results of their CSV2SHP run.

Filter Lab

Formall "PostGIS lab" we really want to focus on typing in CQL expressions and seeing the result in a table.

We will also introduce "connection parameters" and go through changing from a shapefile to postgis.

GeometryCRS

A quick and easy visual for CRS; idea is to open up the BC dataset; and modify the CRS of the MapContext. The idea is to show what a CRS does.

The example has been extended to export a shapefile showing how to process a geometry.

ImageLab

Go through map context and add:

  • raster geotiff or world+image

Bonus: WMS Layer

Add WMS layer. For first cut we will just show the api that is involved; or provide a small code snippet.

Style

Set up a map context with 1) raster base map 2) countries shapefile.

Go through a series of exercise with Style covering:

  • fill
  • stroke for outline
  • point symbolizer to draw a symbol at the centroid of each country
  • text symbolizer for labels
  • raster symbolizer to gray scale the background

Bonus: SelectionDemo

Bring it all together and click on a map location to dynamically create a style showing the "selected" feature. This is how to do selection with out loading everything into memory.

This example is hard in that it introduces a "Tool" we will need to work on the code example to make the tool painfully simple to write.

Clone this wiki locally