Skip to main content

Questions tagged [sqlalchemy]

3 votes
1 answer
123 views

Using ST_Distance with serialized Geography Points vs ST_MakePoint in query

I am developing Python application with astronomy purposes, and am using the spatial abilities of PostGIS to represent celestial coordinates. I have been designing some queries for filtering by cone-...
loaf's user avatar
  • 33
1 vote
1 answer
66 views

Read GeoPandas dataframe with gpd.from_postgis passing parameters to SQLAlchemy query

I'm trying to pass parameters to SQL query to be read with from_postgis function in order to get a geopandas dataframe from a PostGIS database. from sqlalchemy import create_engine from sqlalchemy ...
JoanS's user avatar
  • 23
0 votes
1 answer
51 views

Cannot load a geodataframe (from a shapefile) into PostgreSQL (as table) via SQLAlchemy

I would like to publish a shapefile from a directory to GeoServer by using the Python library geoserver-rest. I understand that in order to do so, I need also to load the shapefile as geodataframe (...
Tms91's user avatar
  • 215
1 vote
1 answer
162 views

Installing GeoAlchemy2 and using its libraries on QGIS Python Console

I have installed GeoAlchemy2 and SqlAlchemy by using the OSGeo command, but I am still not able to import the related libraries on the on QGIS 3.28.15 Python Console. from geoalchemy2 import *
Nihar Sahoo's user avatar
3 votes
1 answer
495 views

From Geodataframe to PostGIS

I have a geodataframe which I am trying to save to a postgis database. I have already created a connection to postgis in pgAdmin (username, password, localhost and table) from geoalchemy2 import ...
bravopapa's user avatar
  • 515
1 vote
1 answer
452 views

Geodataframe.to_postgis() with Flask and tracking SQLAlchemy Models

I have the following situation: My application front end will receive a shapefile input and have to save it to a PostGIS database. After that, the application backend will start a series of tasks that ...
Pedro Cury's user avatar
3 votes
1 answer
61 views

How to map a single PostGIS function to multiple Spatialite functions with GeoAlchemy2

In PostGIS we have ST_Affine(geom, a, b, d, e, xoff, yoff) but in Spatialite this functionality is split across 2 functions: ATM_Transform( geom , affine_matrix ), and ATM_Create(a, b, d, e, xoff, ...
iwishiwasaneagle's user avatar
1 vote
1 answer
536 views

Calculating the distance For each Row with respect to a Common Point

I have two models with no relation Port and a WareHouse each with a lat and long fields. I want to be able to get the distance for each warehouse from the Port and maybe get the closest e.t.c. This is ...
StackEdd's user avatar
  • 113
4 votes
3 answers
198 views

Points which are beyond certain distance from multiple points

I have two tables - first is a list of positions (points) and second is a list of cities (cities). I am using PostGIS and can find all points outside 10nm of New York by using the SQL statement - ...
user3367601's user avatar
0 votes
1 answer
389 views

Inserting GeoDataFrame into existing schema

Is there a straightforward way to insert a GeoDataFrame into an existing schema? I love the geopandas.GeoDataFrame.to_postgis but this creates a new schema. I only need to insert a table into an ...
user18140022's user avatar
1 vote
2 answers
3k views

Setting CRS/SRID using the to_postgis function with GeoPandas?

So, I'm trying to update a PostGIS table after doing some reverse geocoding and other column manipulation I'm running into the find_srid() - could not find the corresponding SRID error. Based on my ...
nizz0k's user avatar
  • 324
7 votes
1 answer
751 views

Uploading a geodataframe with some missing geometries using 'to_postgis'

I have a GeoDataFrame with plenty of info, including a 'geometry' column. Some of the rows have no geometry data... I simply don't have it. I decided to leave those rows as 'None' or 'NoneType' in the ...
Frank Jimenez's user avatar
1 vote
0 answers
4k views

Calculating distance between 2 Shapely Points in Meters

I am trying to calculate the distance (in meters) between 2 lon/lng points of type shapely.geometry.point.Point using Python and Shapely. These 2 points are returned from PostGIS by SQLAlchemy/...
Nyxynyx's user avatar
  • 1,727
2 votes
1 answer
2k views

Change PostGIS Column from Geometry to Geography

I have a PostGIS table with a column of type Geometry(POINT) and SRID 0 that must be changed to the type Geography(POINT) as it will be used to store lat/lon values. How can we make this alteration to ...
Nyxynyx's user avatar
  • 1,727
3 votes
1 answer
883 views

geopandas to_postgis: ValueError: geom (geometry(MULTILINESTRING,4326)) not a string

I have a GeoPandas GeoDataFrame with a column named geom having MultiLineString values as such: print(gdf.to_markdown()) # using package 'tabulate' to display a markdown table | | uid | key | ...
swiss_knight's user avatar
  • 11.4k