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 and a leaflet map. The map has a pointer for the location, and there is two way binding where dragging the pointer changes the value in the input fields and vice-versa. Later on, support for line and polygon columns may be added as well (pull requests welcome).
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:
Add the following to your config.py:
ADDON_MANAGERS = ['fab_addon_geoalchemy.manager.GeoAlchemyManager']
And then use this for your models and views:
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.
Release files for fab-addon-geoalchemy 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fab_addon_geoalchemy-0.4.1.tar.gz | 57.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fab_addon_geoalchemy-0.4.1-py3.5.egg | Legacy Egg format | - | - | Details |
Total release size: 132.6 kB
Release files / fab_addon_geoalchemy-0.4.1.tar.gz
| Download URL | fab_addon_geoalchemy-0.4.1.tar.gz |
|---|---|
| Size | 57.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e752c7db88222696b2189327b5883f6cac89e1cf8653a1f1c384a6df1c88032
|
|
BLAKE2b-256 checksum How to use checksums |
b293f61fafedfb06fcd9e517c30ebd5397857307ae169a954f2e791ae6f5e0f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2
|
Release files / fab_addon_geoalchemy-0.4.1-py3.5.egg
| Download URL | fab_addon_geoalchemy-0.4.1-py3.5.egg |
|---|---|
| Size | 75.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
36295aac23a0a00e0c3341f98dec3df6ac45846ad5914474220f875fde0a6fde
|
|
BLAKE2b-256 checksum How to use checksums |
9b5a9d4b0d9d4d4a7fb6e62daa44c3ddc542b32127846f3e6b8f2615710a2a9d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.2
|