Skip to main content

Questions tagged [geoalchemy]

GeoAlchemy provides extensions to SQLAlchemy to work with spatial databases.

Filter by
Sorted by
Tagged with
1 vote
1 answer
379 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
52 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
681 views

How to get Feature Collection from PostGIS with GeoAlchemy?

I am building a simple Flask app where I want to display all point data stored in PostGIS with Leaflet. What I want to do, is retrieve data in GeoJSON from PostGIS to Flask (using GeoAlchemy) and then ...
Gatnik's user avatar
  • 75
7 votes
1 answer
533 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
2 votes
1 answer
2k views

Having 'can't adapt type 'Point' error when try to load data from local to PostgreSQL database

I am trying to load this shapefile into the PostgreSQL database. Here is what data looks like: first, read the file data_path = "./RFSNSW_BFPL" rfsnw_bfpl= gpd.read_file( os.path.join(...
Tayrick's user avatar
  • 21
0 votes
1 answer
481 views

GeoAlchemy get largest area within intersected polygon

I am using the world borders dataset to try and perform an intersection based on the buffer of a point. I need to return the country with the largest area within the buffer. For example, in the ...
its30's user avatar
  • 567
-2 votes
2 answers
958 views

Function like ST_AsGeoJSON but returning dictionary?

Is there some way for ST_AsGeoJSON to return a dictionary instead of a json-string? I want to use this value in another API, which leads to the string being escaped like this instead of being used as ...
FrankyBoy's user avatar
  • 153
3 votes
1 answer
5k views

How to cast Geometry to Geography in PostGIS/Postgres with sqlalchemy + geoalchemy

Some PostGIS functions behave differently based on the arguments types. Example: ST_Distance will calculate projected units distances for geometry arguments and meters distances for geography ...
Efren's user avatar
  • 191
4 votes
2 answers
2k views

GeoAlchemy get closest point to another point

I have loaded into my db the cities1000.txt available here. I am attempting to create a query using GeoAlchemy to return the nearest city when I pass in Lat and Long. I currently have the query setup ...
its30's user avatar
  • 567
2 votes
3 answers
3k views

Creating a geoTIFF from PostGIS raster column

I am able to retrieve raw raster data from a PostGIS raster in a PostgreSQL database using SQL Alchmey. I can get the raw data directly from the database. Now I would like to create a geoTIFF file ...
spiceking's user avatar
14 votes
1 answer
14k views

Converting geoalchemy2.elements.WKBElement to WKT

I have a geoalchemy2.elements.WKBElement that comes from a query on a Postgres/PostGIS view. I want to convert this to WKT, or otherwise encode it so that it is (Geo)JSON serialisable. How can I ...
alphabetasoup's user avatar
2 votes
1 answer
361 views

Polygons generated using python-script appear stretched?

We are trying to generate a grid of hexagons that is supposed to span the whole of Germany. The code we are using to generate this grid is as follows (excluding some sqlalchemy related parts): from ...
R. Martin's user avatar
2 votes
1 answer
1k views

Write GeoJSON As Feature Object in Postgis

I'm trying to create a geofence/circle from a lat/long set and I'm close except that the GeoJSON that PostGIS creates differs in structure from the client library that our front-end uses. Here is my ...
mmcclannahan's user avatar
1 vote
2 answers
2k views

Casting between PostGIS types in GeoAlchemy

I'm working with OpenStreetMap data, and loading it into a PostGIS database using osm2pgsql. The issue that I am currently dealing with is that osm2pgsql stores the shape as a geometry type. I'm ...
Andrew Wong's user avatar
0 votes
1 answer
1k views

SQLAlchemy Error on insert

I am trying to add a point with GeoAlchemy 2. However I am getting getting error on insert action saying ---sqlalchemy.exc.InternalError: (psycopg2.InternalError) parse error - invalid geometry HINT:...
ncelik's user avatar
  • 561
3 votes
0 answers
775 views

How to add ST_GeomFromEWKT in mysql?

I am using geoalchemy2 with mysql database. I have a polygon field. While inserting I am getting this error - from appmain import application from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy(...
user1532043's user avatar
0 votes
2 answers
97 views

Shapely Not Determining Point in State

I am pulling State geometry data from a database (populated from Shapefiles) to find what state a coordinate pair is in. I was originally using GeoAlchemy, but tens of thousands of queries to ...
mmcclannahan's user avatar
3 votes
0 answers
514 views

How to use pythons' GeoAlchemy2 to filter on dynamically generated Points?

I'm trying to do something like this SQL query in Geoalchemy2: SELECT district_polygons.district FROM markers, district_polygons WHERE ST_Contains(district_polygons.multi_poly, Point(markers....
Danielle M.'s user avatar
4 votes
0 answers
775 views

Using ST_AsText() without session object

I am storing gps locations as feature in a restfull api. The locations are linked by foreign key to "place" objects in a flask/sqlalchemy/geoalchemy framework. I would like to print a user readable ...
user49019's user avatar
0 votes
1 answer
447 views

Creating Map from database

I'd like some general advice on creating dynamic maps. I have a bunch of geospatial points saved on SQL Server and PostgreSQL. People will enter new data into the databases from time to time. I want ...
Ravi Mehta's user avatar
1 vote
3 answers
2k views

GeoAlchemy: AttributeError: type object 'ColumnProperty' has no attribute 'ColumnComparator'

I installed GeoAlchemy using easy_install but when trying to import it returns the following: Traceback (most recent call last): File "", line 1, in import geoalchemy File "C:\...
Matej's user avatar
  • 1,758
1 vote
1 answer
650 views

Fastest way to add shapely geometries to a PostGis database using geoalchemy2

I am looking for the absolute fastest approach to adding +10,000 shapely geometry objects to a PostGIS database using geoalchemy2. I'm having no speed issues when uploading to a localhost postgres ...
asdflkjwqerqwr's user avatar
0 votes
2 answers
1k views

GeoAlchemy pg_function.geojson cannot be decoded with json.loads

I asked this quesiton over on StackOverflow and thought it might make more sense to post it here given it's GIS nature. Given this function: features being a list of SQLAlchemy objects template ...
Joshua Powell's user avatar
12 votes
4 answers
2k views

How to use PostGIS to handle complex geoprocessing workflows?

Our organization is considering moving our geoprocessing workflow to PostGIS. We are currently using ArcGIS, with a plethora of custom Python tools used in ModelBuilder. We're moving most of our data ...
Tanner's user avatar
  • 7,383