Contact:

AndreaAime

Tracker:

GEOT-4444

Tagline:

Clean up shapefile store implementation

Children:

Description

The current shapefile datastore is based on AbstractDataStore, a base class that while not deprecated, is not favoured either for new implementation (the new reference being ContentDataStore). The current implementation is brittle and harder than it should be to maintain, and it's also based on two stores, the plain and indexed ones, that were never merged togheter, effectively duplicating the effort to maintain the code.

The current shapefile-ng module, in unsupported, is based on ContentDataStore instead, providing a set of advantages:

The change only affected the upper level, whilst the code reading shp/dbf/shx/fix/qix files has remained largely untouched.
Migration wise, there are a few cases depending on how much the client code is linked to the shapefile data store specific methods:

Status

This proposal is open for discussion and voting.

Current voting status:

Tasks

This section is used to make sure your proposal is complete (did you remember documentation?) and has enough paid or volunteer time lined up to be a success

 

no progress

(tick)

done

(error)

impeded

(warning)

lack mandate/funds/time

(question)

volunteer needed

  1. (tick) Rename gt-shapefile plugin as shapefile-old in unsupported land
  2. (tick) Move shapefile-ng to plugins/shapefile
  3. (tick) Transition any direct use of ShapefileDataStore to use of factory (done)
  4. Fix up the user guide upgrade instructions using BEFORE / AFTER examples as shown below
  5. Initial pull request https://github.com/geotools/geotools/pull/176

API Changes

Using ShapefileDataStore directly

BEFORE:

ShapefileDataStore store = new ShapefileDataStore(url, new URI("theNamespace"), /*memoryMapped*/ true);

store.setStringCharset(...);
store.setDbfTimeZone(...);

AFTER:

ShapefileDataStore store = new ShapefileDataStore(url);
store.setNamespace(new URI("theNamespace"));
store.setMemoryMapped(true);
store.setCharset(...);
store.setTimeZone(...);