I'm trying to import a layer into a PostGIS database with
gdf.to_postgis('test_polygons', engine, if_exists='append', index=False, dtype={'geom': Geometry(geometry_type='POLYGON', srid= 4326)})
And I'm getting the error:
Traceback (most recent call last): File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1276, in _execute_context self.dialect.do_execute( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 609, in do_execute cursor.execute(statement, parameters) psycopg2.errors.RaiseException: find_srid() - could not find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase mismatch? CONTEXT: PL/pgSQL function find_srid(character varying,character varying,character varying) line 17 at RAISE
I have a custom projection, which i set to the layer Any ideas, what's wrong with geometry and srid?
Full error message:
Traceback (most recent call last): File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1276, in _execute_context self.dialect.do_execute( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 609, in do_execute cursor.execute(statement, parameters) psycopg2.errors.RaiseException: find_srid() - could not find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase mismatch? CONTEXT: PL/pgSQL function find_srid(character varying,character varying,character varying) line 17 at RAISE
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "<pyshell#84>", line 1, in gdf.to_postgis('test_polygons', engine, if_exists='append', index=False, dtype={'geom': Geometry(geometry_type='POLYGON', srid= 4326)}) File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\geopandas\geodataframe.py", line 1097, in to_postgis geopandas.io.sql._write_postgis( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\geopandas\io\sql.py", line 375, in _write_postgis target_srid = connection.execute( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1003, in execute return self.execute_text(object, multiparams, params) File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1172, in _execute_text ret = self._execute_context( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1316, in _execute_context self.handle_dbapi_exception( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1510, in handle_dbapi_exception util.raise( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\util\compat.py", line 182, in raise raise exception File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\base.py", line 1276, in _execute_context self.dialect.do_execute( File "C:\Users\Александр\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 609, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.InternalError: (psycopg2.errors.RaiseException) find_srid() - could not find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table? Is there an uppercase/lowercase mismatch? CONTEXT: PL/pgSQL function find_srid(character varying,character varying,character varying) line 17 at RAISE
[SQL: SELECT Find_SRID('public', 'test_polygons', 'geometry');] (Background on this error at: http://sqlalche.me/e/13/2j85)