Questions tagged [geoalchemy]

GeoAlchemy provides extensions to SQLAlchemy to work with spatial databases.

GeoAlchemy is an extension of SQLAlchemy. It provides support for Geospatial data types at the ORM layer using SQLAlchemy. It aims to support spatial operations and relations specified by the Open Geospatial Consortium (OGC).

Supported Spatial Databases

At present PostGIS, Spatialite, MySQL, Oracle and MS SQL Server 2008 are supported.

Support

GeoAlchemy is at an early stage of development. Its mailing list is available on Google Groups. The source code can be found on GitHub. Also, feel free to email the author directly to send bugreports, feature requests, patches, etc.

Installation

To install type as usual:

$ easy_install GeoAlchemy

Or, download the package, change into geoalchemy dir and type:

$ python setup.py install

References:

http://www.geoalchemy.org/

https://github.com/geoalchemy/geoalchemy

25 questions
10
votes
2 answers

Difficulty serializing Geography column type using sqlalchemy marshmallow

I an trying to use Marshmallow to do do deserialize and serialise SQLAlchemy objects but run into a problem when dealing with Geography fields in the ORM. Firstly the model: class Address(db.Model, TableColumnsBase): __tablename__ = 'address' …
silverdagger
  • 1,124
  • 13
  • 37
9
votes
2 answers

Geoalchemy2 query all users within X meteres

I have an app that takes an address string, sends it to Google Maps API and gets lat/long co-ordinates, I then want to show the all users within X meteres of this point (there lat/long is stored in my database), I then want to filter the result to…
Crooksey
  • 908
  • 3
  • 11
  • 22
5
votes
1 answer

How to set extent of spatial SQL query in python (geoalchemy)

since days i've been hustling around trying to figure out, how to properly query data from a PostGIS database using geoalchemy2, an extension to python's sqlalchemy supporting spatial database operations. I'm working with python3.4 and…
5
votes
2 answers

GeoAlchemy2 store point and query results

The documentation on GeoAlchemy2 doesn't seem fully featured (as compared to the pervious version). I have a model: class AddressCode(Base): __tablename__ = 'address_codes' id = Column(Integer, primary_key=True) code =…
Crooksey
  • 908
  • 3
  • 11
  • 22
4
votes
0 answers

How to create viewonly field in SqlAlchemy and GeoAlchemy2?

I am trying to dynamically populate a field using SqlAlchemy 0.8.4 and GeoAlchemy2 0.2.2. The goal is to assign a District to the Facility based on the facility's position when it is read from the database. The code looks like this: class…
Kristian
  • 6,357
  • 4
  • 36
  • 37
3
votes
1 answer

Access composite data type using sqlalchemy in postgres

I'm trying to pull out composite columns from tiger.geocode function in python using sqlalchemy. In pure sql form this looks like this: SELECT g.rating ,ST_X(g.geomout) As lon ,ST_Y(g.geomout) As lat ,(addy).address As…
3
votes
2 answers

AdminModelConvertor for Geometry Field (LON/LAT)

I want to create a view for Flask-Admin to enter coordinates in a Geometry Field. How can I create two Textfields and convert them into the Geometry Object? This is what I have tried so far (Besides uncountable other things) class…
Remo L.
  • 720
  • 6
  • 19
2
votes
1 answer

How to create geoalchemy expression for a point geometry?

I have a table with lat and long, i don't want to store geometry. Instead i am storing lat and longs. How to create point based queries using position expression? basically it should return point. Which should be converted to SQL expression like…
naren
  • 14,611
  • 5
  • 38
  • 45
2
votes
1 answer

how to use composite data types (e.g. geomval) in SQLAlchemy?

I'm trying to replicate a nested raw PostGreSQL/PostGIS raster query using SQLAlchemy(0.8)/GeoAlchemy2(0.2.1) and can't figure how to access the components of a geomval data type. It's a compound data type that returns a 'geom' and a 'val'. Here is…
gweedoh565
  • 41
  • 5
1
vote
1 answer

How to insert a Geometry with geoalchemy2 and postgresql

I'm trying to insert a geometry data into database but it's not working. I created a model class for Geometry, but i don't now if it's right. Geometry class: from datetime import datetime from sqlalchemy import and_ from sqlalchemy import…
1
vote
1 answer

SQLAlchemy: create_engine() syntax error with PostGIS

currently I am trying to create a postGIS database with sqlalchemy. I plan on normalizing my database by making several tables for shapefile data to be uploaded. my code is as follows: from sqlalchemy import create_engine from…
Ammar Hoque
  • 126
  • 11
1
vote
1 answer

How to convert SDO_GEOMTRY in GeoJSON

I work with sqlalchemy and geoalchemy and will convert my results in geojson. With the normal way like this : print json.dumps([dict(r) for r in connection.execute(query)]) it is not possible because cx_Oracle.Objets not serializable! I can have…
Moehre
  • 151
  • 1
  • 4
  • 17
1
vote
2 answers

SQLAlchemy Reflection Using Metaclass with Column Override

I have a set of dynamic database tables (Postgres 9.3 with PostGIS) that I am mapping using a python metaclass: cls = type(str(tablename), (db.Model,), {'__tablename__':tablename}) where, db.Model is the db object via flask-sqlalchemy and tablename…
Jzl5325
  • 3,898
  • 8
  • 42
  • 62
1
vote
1 answer

GeoAlchemy2: find a set of Geometry items that doesn't intersect with a separate set

I have a postgis database table called tasks, mapped to a python class Task using geoalchemy2/sqlalchemy - each entry has a MultiPolygon geometry and an integer state. Collectively, entries in my database cover a geographic region. I want to select…
Dan Stowell
  • 4,618
  • 2
  • 20
  • 30
1
vote
1 answer

SQLAlchemy \ GeoAlchemy support of PostGIS geometry data types

In an ORM I would expect to be able to do this: session.add(Lake("hello",Polygon([(0,0),(1,0),(1,1)]))) lake = session.get(Lake).first() assert isinstance(lake.geometry, Polygon) assert isinstance(lake.geometry.get_exterior_ring().get_points()[0],…
Giszmo
  • 1,944
  • 2
  • 20
  • 47
1
2