Metadata-Version: 2.1
Name: pygeoapi_plugins
Version: 0.1.0
Summary: pygeoapi plugins
Home-page: https://github.com/cgs-earth/pygeoapi-plugins
Author: Benjamin Webb
Author-email: bwebb@lincolninst.edu
Maintainer: Benjamin Webb
Maintainer-email: bwebb@lincolninst.edu
License: MIT
Keywords: cgs pygeoapi geopython
Platform: all
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: GIS
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygeoapi
Requires-Dist: geoalchemy
Requires-Dist: psycopg2
Requires-Dist: pygeofilter[backend-sqlalchemy]
Requires-Dist: requests
Requires-Dist: SPARQLWrapper
Requires-Dist: SQLAlchemy<2.0.0

# pygeoapi-plugins

pygeoapi plugins developed by the Center for Geospatial Solutions

## OGC API - Features

Additional OGC API - Feature providers are listed below, along with a matrix of supported query parameters.

| Provider           | Property Filters/Display | Result Type  | BBox | Datetime | Sort By | Skip Geometry | CQL | Transactions | CRS |
| ------------------ | ------------------------ | ------------ | ---- | -------- | ------- | ------------- | --- | ------------ | --- |
| `CKAN`             | ✅/✅                    | results/hits | ❌   | ❌       | ✅      | ✅            | ❌  | ❌           | ✅  |
| `PsuedoPostgreSQL` | ✅/✅                    | results/hits | ✅   | ✅       | ✅      | ✅            | ✅  | ❌           | ✅  |
| `SPARQL`           | ❌/✅                    | results/hits | ❌   | ❌       | ❌      | ❌            | ❌  | ❌           | ❌  |

The provider names listed in the table are only accessible in [internetofwater/pygeoapi](https://github.com/internetofwater/pygeoapi), otherwise the full python path is required.

### CKAN

The CKAN Provider enables OGC API - Feature support at the collection level for a specific resource within the datastore-search endpoints of CKAN instances.
It allows you to integrate CKAN resources into your pygeoapi instance.
The provider definition for the CKAN Provider includes configuration options specific to CKAN.
To use the CKAN Provider, you need to specify `pygeoapi_plugins.provider.ckan.CKANProvider` as the provider's name.

```
    providers:
      - type: feature
        name: pygeoapi_plugins.provider.ckan.CKANProvider
        data: https://catalog.newmexicowaterdata.org/api/3/action/datastore_search
        resource_id: 08369d21-520b-439e-97e3-5ecb50737887
        id_field: _id
        x_field: LONDD
        y_field: LATDD
```

In this example, the CKAN Provider is configured to work with the specified CKAN resource.

- `data`: The URL endpoint for the datastore search API of the CKAN instance.
- `resource_id`: The identifier of the specific CKAN resource you want to access within the datastore.
- `id_field`: The field that serves as the unique identifier for features in the CKAN resource.
- `x_field`: The field representing the X-coordinate (longitude) for the features in the CKAN resource.
- `y_field`: The field representing the Y-coordinate (latitude) for the features in the CKAN resource.

### PseudoPostgresSQL

The PseudoPostgresSQL Provider adds a simple capacity to the PostgresSQL Provider in pygeoapi core - faster counting.
This is done by performing a pseudo-count on tables exceeding a definable limit.
The limit is defined using the PSEUDO_COUNT_LIMIT environment variable.
To use the PseudoPostgresSQL Provider, you need to specify `pygeoapi_plugins.provider.postgresql.PseudoPostgreSQLProvider` as the provider's name.

### SPARQL

The SPARQL Provider is a wrapper for any pygeoapi feature provider that provides additional context, allowing integration of SPARQL-based data sources into a pygeoapi instance.
By wrapping another feature provider, the SPARQL Provider inherits queryable capacities from the wrapped feature provider - adding SPARQL context to each resulting feature.
The provider definition for the SPARQL Provider is similar to that of the wrapped provider, with the addition of specific SPARQL-related configuration options.
To use the SPARQL Provider, you need to specify `pygeoapi_plugins.provider.sparql.SPARQLProvider` as the provider's name.

```
    providers:
      - type: feature
        name: pygeoapi_plugins.provider.sparql.SPARQLProvider
        data: /pygeoapi_plugins/tests/data/ne_110m_populated_places_simple.geojson
        id_field: id
        sparql_provider: GeoJSON
        sparql_endpoint: https://dbpedia.org/sparql
        sparql_subject: uri
        sparql_predicates:
          leader: dbpedia2:leaderName|dbp:leaderName
          population: dbo:populationTotal|dbp:populationCensus
```

In this example, the SPARQL Provider wraps the GeoJSON Provider.
The SPARQL Provider only uses variables prefixed with sparql\_ in the configuration.

- `data`: The path to the data file used by the wrapped provider (GeoJSON Provider in this case).
- `id_field`: The field that serves as the unique identifier for features in the data.
- `sparql_provider`: The name of the provider that will handle the SPARQL query results (GeoJSON Provider in this case).
- `sparql_endpoint`: The SPARQL endpoint URL to query for data.
- `sparql_subject`: The SPARQL variable representing the subject URI in the query.
- `sparql_predicates`: A mapping of attribute names to SPARQL predicates. These predicates will be used to query specific attributes in the SPARQL data source.

## OGC API - Processes

Additional OGC API - Process are listed below

### Intersector

The intersection process uses OGC API - Features Part 3: Filtering to return CQL intersections of features.
An example configuration in a pygeoapi configuration is below.

```
  intersector:
    type: process
    processor:
      name: pygeoapi_plugins.process.intersect.IntersectionProcessor
```

This plugin is used in https:/reference.geoconnex.us/.

### Sitemap Generator

The Sitemap Generator process makes use of the XML formatter and OGC API - Features to generate a sitemap of the pygeoapi instance.
This can be used with the python package [sitemap-generator](https://github.com/cgs-earth/sitemap-generator) to generate a sitemap index.
An example configuration in a pygeoapi configuration is below.

```
  sitemap-generator:
    type: process
    processor:
      name: pygeoapi_plugins.process.sitemap.SitemapProcessor
```
