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
1
vote
0 answers

asyncpg exceptions DataError invalid input for query argument

My model boundary_table = Table( 'boundary', metadata, ... Column('geom', Geometry(geometry_type='GEOMETRY'), nullable=False) ) My View class DetailBoundaryView(handlers_base.BaseView): URL_PATH =…
1
vote
1 answer

Error with inserting a point into a geometry (point) typed column in Postgress with PostGIS

I need to insert a point into Column(Geometry(geometry_type='POINT', srid=4326)). I can not figure out how to implement the srid=4326 into the point data POINT(58.183594 22.593726). I searched for it. I still cannot solve…
Sami Al-Subhi
  • 4,406
  • 9
  • 39
  • 66
1
vote
1 answer

geoalchemy Insert mix of linestring and multilinestring with Z to postgis

I want to insert records from an API to my database postGIS. The api geometry respond with a mix of linestring and mulitlinestring with Z value. How can i mix both types into the same geometry column? As soon as i hit a record that is a linestring…
geogrow
  • 485
  • 2
  • 9
  • 26
1
vote
1 answer

Serialise a WKB into WKT or geojson in flask marshmallow/marshmallow-sqlalchemy

I've got a bunch of GIS tables in my model that I created in flaskSQLAlchemy. Each of these models has a 'geom' field which is a WKB object. Which need to be JSON serialized into WKT or geojson, So that The API GET call would work. I tried to use…
1
vote
2 answers

How do you create a table in mysql using SQLalchemy with a spatial column?

I am trying to create a table using SQLalchemy and geoalchemy2 like so: class RLocModel(Base): __tablename__ = 'rloc' id = Column(Integer, primary_key=True) loc = Column(Geometry('POINT')) This is against a mysql…
pbx
  • 689
  • 1
  • 10
  • 22
1
vote
1 answer

PostGIS: Converting Text WKT/WKB/WKB Hex to Polygon

I am importing Polygon shapes into a PostGIS database, using Python (GeoPandas, SQLAlchemy, GeoAlchemy2). I followed the instructions mentioned here. I have a database with a table named maps_region with a column/field called geom. I am able to get…
briangoodness
  • 69
  • 1
  • 6
1
vote
0 answers

How can I create a many-to-many relationship with SQLAlchemy using a SQL function?

I want to create a relationship between two models that have Geometry columns. For example: from geoalchemy2.types import Geometry from flask.ext.sqlalchemy import SQLAlchemy from myapp import app db = SQLAlchemy(app) class Property(db.Model): …
mjumbewu
  • 1,104
  • 5
  • 14
  • 28
1
vote
2 answers

sqlAlchemy converts geometry to byte using ST_AsBinary

I have a sqlAlchemy model that has one column of type geometry which is defined like this: point_geom = Column(Geometry('POINT'), index=True) I'm using geoalchemy2 module: from geoalchemy2 import Geometry Then I make my queries using sqlAlchemy…
Falcoa
  • 2,612
  • 1
  • 20
  • 30
1
vote
1 answer

SQLAlchemy: Invalid SQL with load_only, order_by and limit

When running the example below, the following, invalid SQL query is generated: SELECT anon_1.venue_id AS anon_1_venue_id, St_asbinary(anon_1.venue_location) AS anon_1_venue_location, St_asbinary(anon_1.anon_2) AS…
vincent
  • 1,953
  • 3
  • 18
  • 24
1
vote
1 answer

How to create a migration script to add a Geometry column in SQLAlchemy-Migrate?

I'm following the Flask mega tutorial. It all worked well until I tried to add a Geometry column to the database. Note it is in the Post class, called location. #! model.py from app import db from geoalchemy2 import Geometry class User(db.Model): …
0
votes
0 answers

SQLAlchemy: modify value on attribute set

I have a following model: class Place(Base): __tablename__ = 'places' id: Mapped[BigIntPk] name: Mapped['str'] = mapped_column( String(128, collation=RU_RU_CE_COLLATION_NAME), ) address: Mapped['str'] = mapped_column( …
Aleksei Khatkevich
  • 1,923
  • 2
  • 10
  • 27
0
votes
1 answer

filter by polygon includes points

I have a fastapi route, that receive 2 coordinate points of rectangle (left-bottom and right-top). I need to select all my rows from table, that has column "coodinates", that contains geometry(Point,4326) type (I use Geoalchemy2 for it). So, how can…
Dmitriy Lunev
  • 177
  • 2
  • 12
0
votes
1 answer

SQL alchemy geoalchemy selecting geometry array

I've created irregular geometry table which contains point array as geometry type column and I'm trying to retrieve points as per measurement point id. But I'm having an error : ProgrammingError: (psycopg2.errors.CannotCoerce) cannot cast type…
0
votes
0 answers

Why is ST_Contour returning error "band number must be between 1 and 0 inclusive", when value passed to the function is 1?

I am trying to use ST_Contour() to create contour lines from a raster stored in db. When I pass: SELECT ST_Contour(my_raster_column, 1, 5, 0) FROM my_schema.my_table WHEN my_other_column IS NOT NULL (I am using async python with…
0
votes
0 answers

How do i get relationship to load when i am selecting Columns in ORM?

I have the following models: class A(Base): __tablename__="tableA" id = Column(Integer, primary_key=True, index=True) name = Column(String, unique=True) coordinates= Column(Geometry(srid=4326,geometry_type="POINT")) b_rel =…
GabiP
  • 1
  • 1