Skip to main content

A small example package

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py4geo-1.0.5b0.tar.gz (41.4 kB view details)

Uploaded Source

Built Distribution

py4geo-1.0.5b0-py3-none-any.whl (50.0 kB view details)

Uploaded Python 3

File details

Details for the file py4geo-1.0.5b0.tar.gz.

File metadata

  • Download URL: py4geo-1.0.5b0.tar.gz
  • Upload date:
  • Size: 41.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 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

File hashes

Hashes for py4geo-1.0.5b0.tar.gz
Algorithm Hash digest
SHA256 3670fdef74708e19c0f4bd0bb0e4bcc8ff286e7e2b5f48287eef937f34ff2d94
MD5 577f1134afd6a80858af9df1df05b119
BLAKE2b-256 0576715dbce2c2fd2593360daaae7cc6243df7b6058531b7aed811268bb89a22

See more details on using hashes here.

File details

Details for the file py4geo-1.0.5b0-py3-none-any.whl.

File metadata

  • Download URL: py4geo-1.0.5b0-py3-none-any.whl
  • Upload date:
  • Size: 50.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 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

File hashes

Hashes for py4geo-1.0.5b0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fcf27e205816a0f5b658dbcf0001f1e31b77f0d9c8daa8687b18755e250d61e
MD5 0d5c2502e49cf0d9c5102b20f12bfe86
BLAKE2b-256 76b2acd9474668c9c69f19cf353320d40dc821fba85f4e5e8e6d811041d56a05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page