Add BigQuery support to Geoserver.
Build or download the JARs and copy them into geoserver's WEB-INF/lib
folder in the same way you install other geoserver plugins.
A .zip
containing the bigquery-geotools
JAR and required dependency JARs is built against JDK 8 is available in under releases.
- Use Cloud Build
gcloud builds submit .
- Build locally. Requires JDK 8+.
mvn package -DskipTests
The service account used to authenticate with BigQuery needs the following permissions:
- bigquery.jobs.create
- bigquery.tables.get
- bigquery.tables.getData
- bigquery.tables.lister
You can use one of three authentication methods to connect to BigQuery, depending on your requirements:
-
If your geoserver instance is running inside GCP, on a VM or elsewhere, you can make use of Default service account credentials. (Recommended)
-
Set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable -
Export a service account key JSON file, add it to disk, and manually select the file when configuring the BigQuery data source. Note: Do not store the service account key file in the geoserver data directory, it may not be secure there.
Create a new data soruce he same way as other databases. Under Stores
, select Add New Store
, then select BigQuery Table
.
Now, you will configure the connection to a BigQuery dataset. Datasets can contain many tables, and are roughly analogous to PostGIS schemas.
The Pregenerate Materialized Views
setting will do one of the following:
MV_NONE
: do not generate or utilize any pregenerated materialized views.MV_USE_EXISTING
: utilize any existing materialized views, but do not generate any.MV_PREGEN_ALL
: pregenerate 4 tables of simplified geometries at tolerances1m
,10m
,100m
, and1000m
.
To generate materialized views manually, see this sample SQL.
Select Publish
to configure and publish a vectory layer from BigQuery.
There are several configuration options that can be set when adding a BigQuery data source.
Parameter | Default | Description |
---|---|---|
Access Method | QUERY_API |
Select whether to query using the BigQuery Storage API or standard Query API. |
Simplify Geometries | true |
Attempt to simplify geometries at wider zoom levels without impacting accuracy |
Use Query Cache | true |
Use the BigQuery query cache when possible |
Query Recent Partition | true |
When querying a partitioned table, automatically detect the most recent partition and use it for queries |