Table Of Contents

Previous topic

Oracle Plugin

Next topic

SpatiaLite Plugin

This Page

PostGIS Plugin

Supports direct access to the PostGIS database.





Note that the groupId is org.geotools.jdbc for this and other JDBC plugin modules.

Connection Parameters

Parameter Description
“dbtype” Must be the string “postgis”
“host” Machine name or IP address to connect to
“port” Port number to connect to, default 5432
“schema” The database schema to access
“database” The database to connect to
“user” User name
“passwd” Password


Connect using DataStore finder:

    Map<String,Object> params = new HashMap<>();
    params.put( "dbtype", "postgis");
    params.put( "host", "localhost");
    params.put( "port", 5432);
    params.put( "schema", "public");
    params.put( "database", "database");
    params.put( "user", "postgres");
    params.put( "passwd", "postgres");
    DataStore dataStore=DataStoreFinder.getDataStore(params);


Parameter Description
“loose bbox” Flag controlling loose bbox comparisons, default is true
“preparedStatements” Flag controlling whether prepared statements are used, default is false

Example use:

params.put(PostgisDataStoreFactory.LOOSEBBOX, true );
params.put(PostgisDataStoreFactory.PREPARED_STATEMENTS, true );

Configuration Flags

An optimization on spatial queries can be applied, to avoid a bug with PostGIS query planner with big geometries and small bboxes, setting a system property.

This optimization can be enabled using a system-wide default from the command line: