[Qgis-user] urls / links as attribute values

Andreas Neumann a.neumann at carto.net
Tue Oct 25 07:05:28 PDT 2011


 yes - and this should also work for all OS - not just, Windows, Linux 
 or OSX.

 Thanks,
 Andreas

 On Tue, 25 Oct 2011 15:44:54 +0200, Giuseppe Sucameli wrote:
> Hi all,
>
> On Tue, Oct 25, 2011 at 3:05 PM, Andreas Neumann 
> <a.neumann at carto.net> wrote:
>> It would be nice, however, to have a new data type in the fields 
>> parameters
>> named "URL/URI" which would automatically open the browser, either 
>> inline
>> (through webkit) or by opening the systems default webbrowser.
>
> just set the action type to python and then use pyQT :)
>
>
> The following python code should open the file pointed by %FIELD
> with the default application (e.g. an image viewer):
>
> from PyQt4.QtCore import QUrl; from PyQt4.QtGui import
> QDesktopServices; QDesktopServices.openUrl( 
> QUrl.fromLocalFile(%FIELD)
> );
>
>
> The next one will get an url instead, so if %FIELD contains
> http://www.qgis.org it should open the web browser:
>
> from PyQt4.QtCore import QUrl; from PyQt4.QtGui import
> QDesktopServices; QDesktopServices.openUrl( QUrl(%FIELD) );
>
>
> It's easy, isn't it? :)
> Regards.
>
>> Andreas
>>
>> On Tue, 25 Oct 2011 14:21:00 +0200, Richard Duivenvoorde wrote:
>>>
>>> Hi List,
>>>
>>> we have a webservice which returns a shapefile with attributes.
>>>
>>> one of the attribute values is a full url to some real time 
>>> generated
>>> report for every feature in the shape (one report for every 
>>> feature).
>>>
>>> I found it not so easy to select/copy/paste the link and open it in 
>>> a
>>> browser (after loading the shape in qgis)... Not from the attribute
>>> window, nor via the getinfo tool (these are long complex url's).
>>>
>>> Ideally it would be nice to be able to just click on those url's 
>>> and
>>> then let them open the report in a browser.
>>>
>>> Is this possible, or has anybody a clever idea how to to that?
>>>
>>> We can offcourse alway build a plugin for that :-)
>>>
>>> Regards,
>>>
>>> Richard Duivenvoorde
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>> --
>> --
>> Andreas Neumann
>> Böschacherstrasse 10A
>> 8624 Grüt (Gossau ZH)
>> Switzerland
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>

-- 
 --
 Andreas Neumann
 Böschacherstrasse 10A
 8624 Grüt (Gossau ZH)
 Switzerland



More information about the Qgis-user mailing list