Bera
Bera

Reputation: 1949

Download GIS data using owslib

I want to create a geopandas dataframe from a url using owslib:

from owslib.wfs import WebFeatureService
url = 'https://somesecreturl.com/geoserver/wms?&authkey=79sd7a9sd-sda798-4531-a8a9-454hj5h3453' #(I've changed the authkey)  
wfs = WebFeatureService(url=url)

Last line is causing error:

Traceback (most recent call last):

File "", line 2, in wfs = WebFeatureService(url=url)

File "C:\ProgramData\Anaconda3\lib\site-packages\owslib\wfs.py", line 42, in WebFeatureService return wfs100.WebFeatureService_1_0_0(clean_url, version, xml, parse_remote_metadata,

File "C:\ProgramData\Anaconda3\lib\site-packages\owslib\feature\wfs100.py", line 80, in new obj.init(url, version, xml, parse_remote_metadata, timeout,

File "C:\ProgramData\Anaconda3\lib\site-packages\owslib\feature\wfs100.py", line 105, in init self._capabilities = reader.read(self.url)

File "C:\ProgramData\Anaconda3\lib\site-packages\owslib\feature\common.py", line 53, in read request = self.capabilities_url(url)

File "C:\ProgramData\Anaconda3\lib\site-packages\owslib\feature\common.py", line 28, in capabilities_url qs = cgi.parse_qsl(service_url.split('?')[1])

AttributeError: module 'cgi' has no attribute 'parse_qsl'

The exact same code is working on Another computer (with other versions of some packages and python)

I have tried to export the working env package version as a text file and:

conda create --name <env> --file <this file>

But that is giving me:

Collecting package metadata (current_repodata.json): done Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

What can I do now?

Upvotes: 1

Views: 859

Answers (1)

Bera
Bera

Reputation: 1949

The "solution" was to uninstall Anaconda and install an older version (Anaconda3-2019.03)

then install packages:

  • geopandas
  • owslib

And update pyproj package

Upvotes: 0

Related Questions