Skip to main content

Summary

Add types and functions to work with geometric attributes that are stored in a Postgis database (that is a PostgreSQL database with Postgis extension enabled).

The present cube supports only version 2.0 and later of Postgis.

It introduces one new type when defining attributes in the data model schema:

  • a Geometry type. Additionally, you should give the following elements along with a Geometry attribute:

    • geom_type. The Postgis type of geometries that this attribute will accept, for example POINT, MULTILINESTRING or POLYGON,

    • srid. The spatial reference system the geometry coordinates will live in. This is an integer and a foreign key that must match the srid key in the spatial_ref_sys table. Most of the time, it will be the same as the spatial system EPSG code,

    • coord_dimension. The number of dimensions used by geometries. Defaults to 2.

  • a Geography type (see the description).

Then you can also use geometric functions like ST_INTERSECTS, ST_WITHIN or ST_UNION to work with this new type.

See Postgis manual for reference documentation about Postgis.

Example

In schema.py, one can declare a City entity like the following.

class City(EntityType):
    name = String(required=True)
    geometry = Geometry(geom_type='POLYGON', srid=4326)

You may then make queries like:

# get all cities in a given bounding box
rql('City C WHERE C geometry G HAVING(ST_WITHIN(G, ST_MAKEENVELOPE('
    '%(left)s, %(bottom)s, %(right)s, %(top)s, 4326)) = TRUE)',
        {'left': 2.2,
        'right': 2.6,
        'top': 49,
        'bottom': 48})

# get all cities at a given distance from a point, sorted by distance
rql('Any C, ST_DISTANCE(G, ST_SETSRID(ST_MAKEPOINT(2.2, 48.4), 4326)) '
    'ORDERBY 5 WHERE '
        'C geometry G HAVING ('
        ' ST_DWITHIN(G, ST_SETSRID(ST_MAKEPOINT(2.2, 48.4), 4326), 0.1) = TRUE)')

Metadata

Release files for cubicweb-postgis 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cubicweb-postgis 1.0.0
File Size Uploaded Provenance Actions
cubicweb-postgis-1.0.0.tar.gz 10.0 kB Without provenance Details for cubicweb-postgis-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cubicweb-postgis 1.0.0
File Interpreter ABI Platform Actions
cubicweb_postgis-1.0.0-py3-none-any.whl Python 3 none any Details for cubicweb_postgis-1.0.0-py3-none-any.whl

Total release size: 19.7 kB

Release files / cubicweb-postgis-1.0.0.tar.gz

Download URL cubicweb-postgis-1.0.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
72d13c433500cbda1b3ba608e7c17371fb95c2a220afcd69d44311e94e998863
BLAKE2b-256 checksum
How to use checksums
9d5e57758dfb451cd73874341dab68e0ab17c217be196fcea0672875489e8c85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Release files / cubicweb_postgis-1.0.0-py3-none-any.whl

Download URL cubicweb_postgis-1.0.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b3a43af3831fb1b8efd9bb0b147d2d0ee32b9c5aeb242244fc9f7a487780fd6
BLAKE2b-256 checksum
How to use checksums
169f36e1bf39f44dbb03add439d19266fcef3c0d712cb1e782bc61fca526be31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Security for cubicweb-postgis 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page