Skip to main content

Py4Geo

Is still experimental...

Description

This module implements a DAL database model inspired to the OpenstreetMap database, optimized for storing informations, with a very flexible json structure able to host and model any kind of data.

It supports OpenstreetMap and geojson as main data structures for import.

System requirements

Optional requirements

Install

pip install py4geo

Use Py4geo in custom py4web applications

Py4web applications are nothing more than native python modules, Py4geo tools can be imported from them and for integration you just need to overwrite few basic setting variables.

Setup

  1. Define in your application settings subsequent variables with values adapted to your needs:

    # db settings
    # WARNING! Commented out variables are optional.
    # DB_FOLDER =
    DB_URI = "postgres://<PG user>:<password>@<host name>/<db name>"
    # DB_POOL_SIZE = 10
    # DB_MIGRATE = True # Actually True is the default if not specified.
    # MATERIALIZED_VIEWS = []
    
  2. Create your own setup script (setup.py) in the root of your application:

    from . import settings
    from py4geo import settings as py4geo_settings
    
    py4geo_settings.DB_URI = settings.DB_URI
    py4geo_settings.DB_FOLDER = settings.DB_FOLDER
    py4geo_settings.MATERIALIZED_VIEWS = settings.MATERIALIZED_VIEWS
    
    from py4geo.setup import initdb
    
    initdb()
    
    # WARNING! These imports must follow the call of the previous initdb function.
    from py4geo.setup.setup import modelsetup
    # Importing the model defined tables are automatically created
    from py4geo.models import db
    # This will create necessary geometry views.
    modelsetup()
    
  3. Go to your apps folder and run:

    cd path/to/apps
    python -m <yourAppName>.setup
    

WARNING the script will ask for necessary PostgreSQL power user credentials that you must know.

Share your py4web/web2py application database with Py4geo

You have two options

  • Overwrite the settings variable DB_URI with a valid PostgreSQL connection string to a PostGIS dtabase.

  • Overwrite the db variable in the common module with a DAL object connected to a PostGIS database.

Resources

Dev notes

Release files for py4geo 1.0.8

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

Source distribution (sdist)

Source distribution for py4geo 1.0.8
File Size Uploaded
py4geo-1.0.8.tar.gz 41.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py4geo 1.0.8
File Interpreter ABI Platform
py4geo-1.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 92.3 kB

Release files / py4geo-1.0.8.tar.gz

Download URL py4geo-1.0.8.tar.gz
Size 41.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2e897576c36e0e4ba37004f278128bfba2f5dfb41a06096208a46afcdcfe3e61
BLAKE2b-256 checksum
How to use checksums
4017b137d2108308e3413a2e84413548aab1b5a880fe4403b97d66a4125b9cf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0

Release files / py4geo-1.0.8-py3-none-any.whl

Download URL py4geo-1.0.8-py3-none-any.whl
Size 50.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c672dce7257ee57c43a56db8ca7a9c1b8feba10e59f3158bbe3934b55beb99c7
BLAKE2b-256 checksum
How to use checksums
e729d98bf6b0d5ae243657c8fb6b4a68ad3714717e6b93fd894287e9d0ae89c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.1

2 release files

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