Questions tagged [geoalchemy2]

GeoAlchemy 2 is a Python toolkit for working with spatial databases. It is based on the gorgeous SQLAlchemy.

GeoAlchemy 2 is a Python toolkit for working with spatial databases. It is based on the gorgeous SQLAlchemy.

https://github.com/geoalchemy/geoalchemy2

62 questions
18
votes
4 answers

How to get lng lat value from query results of geoalchemy2

For exammple, class Lake(Base): __tablename__ = 'lake' id = Column(Integer, primary_key=True) name = Column(String) geom = Column(Geometry('POLYGON')) point = Column(Geometry('Point')) lake = Lake(name='Orta',…
Chung
  • 1,063
  • 1
  • 13
  • 21
7
votes
0 answers

3D points in geoalchemy2

I'm having difficulty with (I think) the ORM for geoalchemy2. My model is defined as follows: class Location(Model): point = Column(Geometry('POINT', dimension=3, srid=4326)) I later insert as follows: location =…
astex
  • 1,045
  • 10
  • 28
7
votes
1 answer

Representing Coordinates in GeoAlchemy2

To extend my restfull api with GPS locations I decided to try geoalchemy. I already have a database going and I think it saves the points to my database already. However, everytime I try to print a point that I saved (for instance to return to the…
hasdrubal
  • 1,024
  • 14
  • 30
6
votes
1 answer

How do I convert a geography column to latitude and longitude?

I am using PostgreSQL, SQLAlchemy and GeoAlchemy2 libraries to store some geospatial coordinates in the database. I define the database column in my database as follows using Python: import sqlalchemy as sa import geoalchemy2 as ga geo =…
Luca
  • 10,458
  • 24
  • 107
  • 234
6
votes
2 answers

Alembic migration for GeoAlchemy2 raises NameError: name 'geoalchemy2' is not defined

I've decided to write a small webapp using Flask, postgresql and leaflet. I wanted to store coordinates (latitude and longitude) using PostGIS extender for postgresql. My flask application uses Flask-SQLAlchemy, blueprint and especially…
mattberjon
  • 105
  • 2
  • 8
5
votes
1 answer

Error spatially subsetting and PostGIS database

I am trying to make an spatial operation using sqlalchemy and geoalchemy2 on Python 3.5. I have a table with points as a geom attribute. I have already read the table and follow the documentation instructions: metadata = MetaData() table =…
topcat
  • 586
  • 1
  • 6
  • 30
5
votes
3 answers

Can't transform geometry to geojson

My problem is this. I'm creating a model for some data. class Cables(Base): __tablename__ = 'cables' id = Column(Integer, nullable=False) route = Column(Geometry(geometry_type='LINESTRING', srid=4326), nullable=False) Now, I want to…
Tomas Wolf
  • 218
  • 2
  • 10
4
votes
1 answer

How to use SQLAlchemy @compiles decorator for geoalchemy2 types

I'm trying to create an in-memory SQLite database off of SQLAlchemy ORMs originally designed for a Postgres database. To allow the SQLite engine to convert postgres specific datatypes, I've relied on the SQLAlchemy @compiles decorator, which works…
Jamie.Sgro
  • 821
  • 1
  • 5
  • 17
4
votes
0 answers

Geoalchemy2 "No Module Named Utils"

I am trying to use GeoAlchemy2 with Python 3.5 and get this following error: from geoalchemy import Geometry from geoalchemy.base import * from utils import from_wkt ImportError: No module named 'utils' Is there an easy solution to this?
rsgny
  • 565
  • 1
  • 6
  • 17
4
votes
1 answer

How to order a geospatial query by distance from the query point

I try searching for this problem on the web, but to no avail. Seems like a basic task. I'm using PostGresql through SQLAlchemy with Geoalchemy to do geospatial queries. Technically, I'm using `Flask-SQLAlchemy. I can do a geospatial query. For…
J-bob
  • 8,380
  • 11
  • 52
  • 85
4
votes
1 answer

GeoAlchemy2: Extracting geo properties from a geom column

Following the GeoAlchemy tutorial, I have created an object with the following geom field: Base = declarative_base() class House(Base): .... geom = Column(Geometry('POINT', 4326)) When I query the object from the database, with: house =…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
3
votes
1 answer

Alembic generates arbitrary type changes for Geometry columns

I'm working on a project that uses SQLite as a database and Alembic as a database migration tool. It includes spatial data and therefore, spatial extensions and geoalchemy2 are included in the project. I'm using autogenerate command and it detects…
Baris
  • 397
  • 5
  • 12
3
votes
0 answers

(psycopg2.ProgrammingError) can't adapt type 'WKBElement'

I am trying to send data from one database table to a separate database and table. To do this I am working with sqlalchemy and geoalchemy2. Here is a snippet of the code. s = sqlalchemy.select([source_table]) with engine.connect() as conn: rp =…
loneStar
  • 31
  • 3
3
votes
3 answers

GeoAlchemy2: Get the lat, lon of a point

Consider the following SQLAalchemy / GeoAlchemy2 ORM with a geometry field: from geoalchemy2 import Geometry, WKTElement class Item(Base): __tablename__ = 'item' id = Column(Integer, primary_key=True) ... geom =…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
3
votes
1 answer

Selecting and ordering by distance with GeoAlchemy2. Bad ST_AsBinary wrap

I'm trying to select and order stores by their distance to a point with GeoAlchemy2 / PostGIS but for some reason I keep getting an error. It seems GeoAlchemy2 wraps things with ST_AsBinary, but when I try to select the distance it tries to wrap the…
OdraEncoded
  • 3,064
  • 3
  • 20
  • 31
1
2 3 4 5