Error in Python code when importing geometry into River Database Tables

0 votes
asked Feb 28, 2017 by Mike_01 (180 points)
edited Feb 28, 2017 by Mike_01

Hi - using the 'Baldeagle' data I have created river database tables, however, when I use the 'Import layers into river database tables' tool, I received the errors below.

The database connection seems okay (am using pgAdmin 4), though I read in another post that you need to create a PostGIS extension - I have used a postgres_fdw' extension since 'postgis' is not available from the dropdown list.

Can anyone help? Thanks, Mike

1. Error In the RiverGIS application window:

Import data into RAS PostGIS tables...

ProgrammingError('type "geometry" does not exist\nLINE 3: geom geometry(LINESTRING, 102728),\n ^\n',)

Process aborted!

1. Error in a QGIS window:

An error has occurred while executing Python code:

KeyError: 'StreamCenterlines'

Traceback (most recent call last):
  File "C:/Users/MGreen/.qgis2/python/plugins\rivergis\", line 298, in acceptDialog
    self.processLayers(key, data)
  File "C:/Users/MGreen/.qgis2/python/plugins\rivergis\", line 280, in processLayers
KeyError: 'StreamCenterlines'

Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
QGIS version: 2.18.3 Las Palmas, 77b8c3d

Python Path:

  • C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins\processing
  • C:/Users/MGreen/.qgis2/python/plugins\postgis_geoprocessing
  • C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python
  • C:/Users/MGreen/.qgis2/python
  • C:/Users/MGreen/.qgis2/python/plugins
  • C:/PROGRA~1/QGIS2~1.18/apps/qgis/./python/plugins
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\matplotlib-1.3.1-py2.7-win-amd64.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\nose-1.3.3-py2.7.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\tornado-4.0.1-py2.7-win-amd64.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\backports.ssl_match_hostname-
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\certifi-14.05.14-py2.7.egg
  • C:\PROGRA~1\QGIS2~1.18\bin\
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\DLLs
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\plat-win
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\lib-tk
  • C:\PROGRA~1\QGIS2~1.18\bin
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\PIL
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\jinja2-2.7.2-py2.7.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\markupsafe-0.23-py2.7-win-amd64.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\pytz-2012j-py2.7.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\win32
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\win32\lib
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\Pythonwin
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\wx-2.8-msw-unicode
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg
  • C:\PROGRA~1\QGIS2~1.18\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg
  • C:/Users/MGreen/.qgis2//python
  • G:/Anybody/HEC-RAS/RiverGIS/baldeagle

1 Answer

+1 vote
answered Feb 28, 2017 by rpasiok (3,601 points)
selected Feb 28, 2017 by Mike_01
Best answer

Hi Mike,

ProgrammingError('type "geometry" does not exist ... means your database is not spatially enabled. You have to create PostGIS extensions for that database, as stated in the requirements [1].

CREATE EXTENSION postgis_topology;


commented Feb 28, 2017 by Mike_01 (180 points)
Hi - many thanks for your answer. It appears that PostGIS was somehow not installed during the pgAdmin/PostgreSQL installation (!) After installing it and enabling the extensions, I am now able to import the geometry :)

I (eventually) managed to figure out how to manually install the PostGIS extensions via the answer at the end of this post:
Welcome to RiverGIS Q&A, where you can ask questions and receive answers from other members of the community.

Visit for documentation and general info about the QGIS plugin.