Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] WMS version 1.3 #332

Open
spasquet opened this issue Jul 12, 2024 · 5 comments
Open

[BUG] WMS version 1.3 #332

spasquet opened this issue Jul 12, 2024 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@spasquet
Copy link

spasquet commented Jul 12, 2024

Hi,

there is a bug when using WMS 1.3 in load_as_array with the following code :

import gemgis as gg

url = 'https://data.geopf.fr/wms-r?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap'
layer='ORTHOIMAGERY.ORTHOPHOTOS'
wms_aerial_array = gg.web.load_as_array(url=url, layer=layer, style='normal', crs='EPSG:2154', 
                             bbox=[966860,967275, 6446505, 6446800], 
                             size=[600, 600], filetype='image/png',
                             save_image=False)

I get the following error :

File "/home/pasquet/Documents/Python/developments/GeoVizPy/geovizpy.py", line 129, in <module>
    wms_aerial_array = gg.web.load_as_array(url=url, layer=layer, style='normal', crs=crs, 
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/gemgis/web.py", line 468, in load_as_array
    wms_map = load_as_map(url=url,
              ^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/gemgis/web.py", line 267, in load_as_map
    wms = load_wms(url)
          ^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/gemgis/web.py", line 91, in load_wms
    wms = owslib.wms.WebMapService(url)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/owslib/wms.py", line 50, in WebMapService
    return wms111.WebMapService_1_1_1(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/owslib/map/wms111.py", line 75, in __init__
    self._capabilities = reader.read(self.url, timeout=self.timeout)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/owslib/map/common.py", line 65, in read
    u = openURL(spliturl[0], spliturl[1], method='Get',
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/trame_env/lib/python3.12/site-packages/owslib/util.py", line 212, in openURL
    raise ServiceException(req.text)
owslib.util.ServiceException: <ServiceExceptionReport xmlns="http://www.opengis.net/ogc">
<ServiceException code="InvalidParameterValue" >
  Valeur du parametre VERSION invalide (1.3.0 disponible seulement))
</ServiceException>
</ServiceExceptionReport>

I found a workaround by modifying line 91 of gemgis/web.py, but there is probably a better way to generalize it.
wms = owslib.wms.WebMapService(url,version='1.3.0')

I'm using gemgis 1.1.8

@AlexanderJuestel
Copy link
Collaborator

@spasquet Thanks for pointing that out. I will put that on my list for the next release which I started working on now

@AlexanderJuestel AlexanderJuestel changed the title WMS version 1.3 [BUG] WMS version 1.3 Jul 20, 2024
@AlexanderJuestel AlexanderJuestel self-assigned this Jul 20, 2024
@AlexanderJuestel AlexanderJuestel added the bug Something isn't working label Jul 20, 2024
@AlexanderJuestel AlexanderJuestel added this to the GemGIS 1.2 milestone Jul 20, 2024
AlexanderJuestel added a commit that referenced this issue Jul 20, 2024
@AlexanderJuestel
Copy link
Collaborator

@spasquet, I added a version argument to the code in 6676046 which should fix the issue. I can open your image without a problem.

image

@spasquet
Copy link
Author

Thanks @AlexanderJuestel !
Do you have an estimate of when the next release will be out ?

@AlexanderJuestel
Copy link
Collaborator

Since I have not been active lately due to completing (successfully) my PhD, I was planning on including a lot of fixes in the next release as GemGIS is also up for being accepted in the PyOpenSci community and I have some stuff to fix there. This may take a month or so. However, I have already pushed the changes to the gemgis_dev branch. Feel free to clone that one :)

@spasquet
Copy link
Author

Congrats on the PhD ! And thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants