0

I am unable to publish a PostGIS table as a GeoServer layer using the gsconfig library. I was able to create a workspace, data store but was unable to publish layers in the store.

While running the script it gives an error on this line

layer1 = cat.publish_featuretype(name = self.tablename, store = schema_store, native_crs='EPSG:4326', srs='EPSG:4326')

The error is as shown below

File "S:\Coding\Python\sz_env\lib\site-packages\gsconfig_py3-1.0.7-py3.9.egg\geoserver\catalog.py", line 716, in publish_featuretype
headers=headers, params=params)   UnboundLocalError: local variable 'params' referenced before assignment

I am unable to figure out the error. Found a similar issue in the below link.

Error publishing PostGIS Layer to Geoserver using Python gsconfig

I tried Ian's version as mentioned in the above link but got an import error. ImportError: cannot import name 'url' from 'urllib'

from geoserver.catalog import Catalog File "<frozen zipimport>", line 259, in load_module File "S:\Coding\Python\sz_env\lib\site-packages\gsconfig_py3-1.0.8-py3.9.egg\geoserver\catalog.py", line 21, in <module> File "<frozen zipimport>", line 259, in load_module File "S:\Coding\Python\sz_env\lib\site-packages\gsconfig_py3-1.0.8-py3.9.egg\geoserver\layergroup.py", line 4, in <module> ImportError: cannot import name 'url' from 'urllib'
3
  • did you add urlib to your enviroment?
    – Ian Turton
    Jan 20 at 16:11
  • Yes, urllib is present in the environment. In fact, it is showing as below while installing your fork. "Using s:\coding\python\sz_env\lib\site-packages Searching for urllib3==1.26.2 Best match: urllib3 1.26.2 Adding urllib3 1.26.2 to easy-install.pth file"
    – Harsha
    Jan 21 at 11:16
  • However, it is urllib3 not urllib. I am not sure whether it would make a difference
    – Harsha
    Jan 21 at 11:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.