Skip to main content

Add support for GeoAlchemy2 Geometry fields to Flask Appbuilder

Project description

fab_addon_geoalchemy

Implementation of GeoAlchemy fields for Flask Appbuilder.

It automatically transforms POINT Geometry columns to widgets with a field for latitude and longitude. The goal is to add a leaflet widget and add support for line and polygon as well.

Installation

Run pip install fab-addon-geoalchemy.

Usage

You can find examples in the unittests in the tests folder. But in short, this is what you need to do:

from sqlalchemy import Column, String
from fab_addon_geoalchemy.views import GeoModelView
from fab_addon_geoalchemy.models import GeoSQLAInterface, Geometry

class Observation(Model):
    id = Column(Integer, primary_key=True)
    name = Column(String)
    location = Column(Geometry(geometry_type='POINT', srid=4326))

    def __repr__(self):
        if self.name:
            return self.name
        else:
            return 'Person Type %s' % self.id


class ObservationView(GeoModelView):
    datamodel = GeoSQLAInterface(Observation)
    add_columns = ['name', 'location']

This will automatically create the LatLonWidget in the form, and process the data to transform the latitude and longitude values into a point geometry in the database. The srid form the column is used by the field for the conversion of the text coordinates to the geometry. No validation is done if the entered coordinates are actually valid for the specified SRID.

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

fab_addon_geoalchemy-0.1.3.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

fab_addon_geoalchemy-0.1.3-py3.5.egg (19.6 kB view details)

Uploaded Egg

File details

Details for the file fab_addon_geoalchemy-0.1.3.tar.gz.

File metadata

  • Download URL: fab_addon_geoalchemy-0.1.3.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for fab_addon_geoalchemy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6ef6b160caeade6570b917cb35e8e4c4e627d9c1128dac8105fa02f0bc9924a6
MD5 f05b1c759db8a26713a09c61d30c21df
BLAKE2b-256 f75f461e13201854490f8c8354577d8a90a8dea61236d624305497407f9f4e83

See more details on using hashes here.

File details

Details for the file fab_addon_geoalchemy-0.1.3-py3.5.egg.

File metadata

  • Download URL: fab_addon_geoalchemy-0.1.3-py3.5.egg
  • Upload date:
  • Size: 19.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for fab_addon_geoalchemy-0.1.3-py3.5.egg
Algorithm Hash digest
SHA256 88f8a30fc0745a421401380f329c19d851eb110b632927f570a6ae56117b921c
MD5 2205ccac035f112861c15fd0b4bd9514
BLAKE2b-256 6048cc4e1ac5d922a563e56f19ed65d4630e489ccd37518d6bca5ee0694b22ac

See more details on using hashes here.

Supported by

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