Get Image using owslib

View: New views
4 Messages — Rating Filter:   Alert me  

Get Image using owslib

by manel.clos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I just tried getting an image from a WMS server using owslib. It seems that line 227 in wms is missing '?' between the base_url and the parameter string (data) because in the examples found in the owslib website, the base_url does not contain the '?'.

/usr/lib/python2.5/site-packages/OWSLib-0.3.1-py2.5.egg/owslib/wms.py
227:            u = self._open(base_url + data)

changing to:
            u = self._open(base_url + '?' + data)

solves the problem. Is this a bug or should I add the '?' to the base_url?

Thanks in advance!

--
Manel Clos
_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community

Re: Get Image using owslib

by dominic.lowe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Manel

This is probably a bug. There's now a more robust method in the utils package that should be used instead of self._open. I'll try and update the wms code when I get a chance (unless anyone else does first).

Could you send me the WMS url please so I can test against it?

Thanks,
Dominic


-----Original Message-----
From: community-bounces@... on behalf of manel.clos@...
Sent: Wed 30/09/2009 10:58
To: community@...
Subject: [Community] Get Image using owslib
 
Hi,

I just tried getting an image from a WMS server using owslib. It seems that line 227 in wms is missing '?' between the base_url and the parameter string (data) because in the examples found in the owslib website, the base_url does not contain the '?'.

/usr/lib/python2.5/site-packages/OWSLib-0.3.1-py2.5.egg/owslib/wms.py
227:            u = self._open(base_url + data)

changing to:
            u = self._open(base_url + '?' + data)

solves the problem. Is this a bug or should I add the '?' to the base_url?

Thanks in advance!

--
Manel Clos
_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community

--
Scanned by iCritical.
_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community

Re: Get Image using owslib

by manel.clos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Dominic,

The WMS server is internal. I was getting a 500 error from the server, so I printed the resulting url in wms.py and it was obvious that the '?' was missing. That solved the problem.

I can test any new version or code if needed.

Thanks!


-----Mensaje original-----
De: community-bounces@... [mailto:community-bounces@...] En nombre de Lowe, Dominic (STFC,RAL,SSTD)
Enviado el: miƩrcoles, 30 de septiembre de 2009 12:10
Para: gispython.org community projects; community@...
Asunto: Re: [Community] Get Image using owslib

Hi Manel

This is probably a bug. There's now a more robust method in the utils package that should be used instead of self._open. I'll try and update the wms code when I get a chance (unless anyone else does first).

Could you send me the WMS url please so I can test against it?

Thanks,
Dominic


-----Original Message-----
From: community-bounces@... on behalf of manel.clos@...
Sent: Wed 30/09/2009 10:58
To: community@...
Subject: [Community] Get Image using owslib

Hi,

I just tried getting an image from a WMS server using owslib. It seems that line 227 in wms is missing '?' between the base_url and the parameter string (data) because in the examples found in the owslib website, the base_url does not contain the '?'.

/usr/lib/python2.5/site-packages/OWSLib-0.3.1-py2.5.egg/owslib/wms.py
227:            u = self._open(base_url + data)

changing to:
            u = self._open(base_url + '?' + data)

solves the problem. Is this a bug or should I add the '?' to the base_url?

Thanks in advance!

--
Manel Clos
_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community

--
Scanned by iCritical.
_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community
_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community

Re: Get Image using owslib

by dominic.lowe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Manel,

Okay thanks - it is still a problem though as it should use the method from
the utils module (which allows with or without a "?")

I just looked at the WMS code though and it's not as straightforward as
replacing the opening method - I'd forgotten the wms module has some extra
code to handle HTTP password authorization when opening urls. So this should
probably also be moved into the openURL method in the utils package (which
also solves the "?" problem).

Thanks for bringing it to our attention - I'll make a ticket for this issue.

Cheers
Dom




On Wednesday 30 September 2009 11:52:02 manel.clos@... wrote:

> Hi Dominic,
>
> The WMS server is internal. I was getting a 500 error from the server, so I
> printed the resulting url in wms.py and it was obvious that the '?' was
> missing. That solved the problem.
>
> I can test any new version or code if needed.
>
> Thanks!
>
>
> -----Mensaje original-----
> De: community-bounces@...
> [mailto:community-bounces@...] En nombre de Lowe, Dominic
> (STFC,RAL,SSTD) Enviado el: miƩrcoles, 30 de septiembre de 2009 12:10
> Para: gispython.org community projects; community@...
> Asunto: Re: [Community] Get Image using owslib
>
> Hi Manel
>
> This is probably a bug. There's now a more robust method in the utils
> package that should be used instead of self._open. I'll try and update the
> wms code when I get a chance (unless anyone else does first).
>
> Could you send me the WMS url please so I can test against it?
>
> Thanks,
> Dominic
>
>
> -----Original Message-----
> From: community-bounces@... on behalf of
> manel.clos@... Sent: Wed 30/09/2009 10:58
> To: community@...
> Subject: [Community] Get Image using owslib
>
> Hi,
>
> I just tried getting an image from a WMS server using owslib. It seems that
> line 227 in wms is missing '?' between the base_url and the parameter
> string (data) because in the examples found in the owslib website, the
> base_url does not contain the '?'.
>
> /usr/lib/python2.5/site-packages/OWSLib-0.3.1-py2.5.egg/owslib/wms.py
> 227:            u = self._open(base_url + data)
>
> changing to:
>             u = self._open(base_url + '?' + data)
>
> solves the problem. Is this a bug or should I add the '?' to the base_url?
>
> Thanks in advance!
>
> --
> Manel Clos
> _______________________________________________
> Community mailing list
> Community@...
> http://lists.gispython.org/mailman/listinfo/community
>
> --
> Scanned by iCritical.
> _______________________________________________
> Community mailing list
> Community@...
> http://lists.gispython.org/mailman/listinfo/community
> _______________________________________________
> Community mailing list
> Community@...
> http://lists.gispython.org/mailman/listinfo/community


_______________________________________________
Community mailing list
Community@...
http://lists.gispython.org/mailman/listinfo/community