FastCollections is a api built for serving/anaylzing large geometric tables from PostgreSQL. FastCollections is written in Python using the FastAPI web framework.
Source Code: https://github.com/mkeller3/FastCollections
FastCollections requires PostGIS >= 2.4.0.
In order for the api to work you will need to add a .env file with your database connections.
Example
DB_HOST=localhost
DB_DATABASE=geoportal
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_PORT=5432
CACHE_AGE_IN_SECONDS=0
MAX_FEATURES_PER_TILE=100000To run the app locally uvicorn api.main:app --reload
Build Dockerfile into a docker image to deploy to the cloud.
| Method | URL | Description |
|---|---|---|
GET |
/api/v1/collections |
Collections |
GET |
/api/v1/collections/{schema}.{table} |
Collection |
GET |
/api/v1/collections/{schema}.{table}/queryables |
Queryables |
GET |
/api/v1/collections/{schema}.{table}/items |
Items |
POST |
/api/v1/collections/{schema}.{table}/items |
Items |
POST |
/api/v1/collections/{schema}.{table}/items/create |
Create Item |
GET |
/api/v1/collections/{schema}.{table}/items/{id} |
Item |
PUT |
/api/v1/collections/{schema}.{table}/items/{id} |
Update Item |
PATCH |
/api/v1/collections/{schema}.{table}/items/{id} |
Modify Item |
DELETE |
/api/v1/collections/{schema}.{table}/items/{id} |
Delete Item |
GET |
/api/v1/collections/{schema}.{table}/tiles |
Tiles |
GET |
/api/v1/collections/{schema}.{table}/tiles/{tile_matrix_set_id}/{tile_matrix}/{tile_row}/{tile_col} |
Tile |
GET |
/api/v1/collections/{schema}.{table}/tiles/{tile_matrix_set_id}/metadata |
Tiles Metadata |
GET |
/api/v1/collections/{schema}.{table}/tiles/cache_size |
Get Tile Cache Size |
DELETE |
/api/v1/collections/{schema}.{table}/tiles/cache |
Delete Tile Cache |
POST |
/api/v1/collections/{schema}.{table}/statistics |
Statistics |
POST |
/api/v1/collections/{schema}.{table}/bins |
Bins |
POST |
/api/v1/collections/{schema}.{table}/numeric_breaks |
Numeric Breaks |
POST |
/api/v1/collections/{schema}.{table}/custom_break_values |
Custom Break Values |
GET |
/api/v1/collections/{schema}.{table}/autocomplete/{column}/{q} |
Autocomplete |
GET |
/api/v1/collections/{schema}.{table}/closest_features |
Closest Features |
POST |
/api/v1/collections/{schema}.{table}/add_column |
Add Column |
DELETE |
/api/v1/collections/{schema}.{table}/column/{column} |
Delete Column |
GET |
/api/v1/collections/{schema}.{table}/download |
Download |
Get a list of collections available to query.
http://localhost:8000/api/v1/collections
Get information about a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}
-
schema=schema -
table=table
Get queryable information about a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/queryables
-
schema=schema -
table=table
Get geojson from a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items
-
schema=schema -
table=table -
bbox=bbox -
limit=limit -
offset=offset -
properties=properties -
sortby=sortby -
sortdesc=sortdesc -
filter=filter -
srid=srid -
return_geometry=return_geometry
Get geojson from a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items
-
schema=schema -
table=table
Create a new item to a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items/create
-
schema=schema -
table=table
Get geojson for one item of a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items/{id}
-
schema=schema -
table=table -
id=id -
properties=properties -
return_geometry=return_geometry -
srid=srid
Update an item in a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items/{id}
-
schema=schema -
table=table -
id=id
Modify an item in a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items/{id}
-
schema=schema -
table=table -
id=id
Delete an item in a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/items/{id}
-
schema=schema -
table=table -
id=id
Get tile information about a collection.
http://localhost:8000/api/v1/collections/{schema}.{table}/tiles
-
schema=schema -
table=table
Get a vector tile for a given table.
http://localhost:8000/api/v1/collections/{schema}.{table}/tiles/{tile_matrix_set_id}/{tile_matrix}/{tile_row}/{tile_col}
-
schema=schema -
table=table -
tile_matrix_set_id=tile_matrix_set_id -
tile_matrix=tile_matrix -
tile_row=tile_row -
tile_col=tile_col -
fields=fields -
cql_filter=cql_filter
Get tile metadata for a given table.
http://localhost:8000/api/v1/collections/{schema}.{table}/tiles/{tile_matrix_set_id}/metadata
-
schema=schema -
table=table -
tile_matrix_set_id=tile_matrix_set_id
Get size of cache for table.
http://localhost:8000/api/v1/collections/{schema}.{table}/tiles/cache_size
-
schema=schema -
table=table
Delete cache for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/tiles/cache
-
schema=schema -
table=table
Retrieve statistics for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/statistics
-
schema=schema -
table=table
Retrieve a numerical column's bins for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/bins
-
schema=schema -
table=table
Retrieve a numerical column's breaks for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/numeric_breaks
-
schema=schema -
table=table
Retrieve custom break values for a column for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/custom_break_values
-
schema=schema -
table=table
Retrieve distinct values for a column in a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/autocomplete/{column}/{q}
-
schema=schema -
table=table -
column=column -
q=q -
limit=limit
Get closest features to a latitude and longitude
http://localhost:8000/api/v1/collections/{schema}.{table}/closest_features
-
schema=schema -
table=table -
latitude=latitude -
longitude=longitude -
limit=limit -
offset=offset -
properties=properties -
filter=filter -
srid=srid -
return_geometry=return_geometry
Create a new column for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/add_column
-
schema=schema -
table=table
Delete a column for a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/column/{column}
-
schema=schema -
table=table -
column=column
Download data from a table.
http://localhost:8000/api/v1/collections/{schema}.{table}/download
-
schema=schema -
table=table -
format=format -
file_name=file_name -
filter=filter -
limit=limit -
offset=offset -
properties=properties