Skip to main content

Plugin to implement Geoalchemy fields in Flask Appbuilder

Project description

THIS PACKAGE HAS BEEN DEPRECATED.

In order to use the proper flask appbuilder addon infrastructure, this package has been deprecated in favor of flask-addon-geoalchemy. This package won’t be updated.

fab_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-geoalchemy.

Usage

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

from fab_geoalchemy.views import GeoModelView
from fab_geoalchemy.interface import GeoSQLAInterface

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_geoalchemy-0.1.6.tar.gz (5.0 kB view hashes)

Uploaded source

Built Distribution

fab_geoalchemy-0.1.6-py3.5.egg (12.6 kB view hashes)

Uploaded 3 5

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page