Re: [Qgis-developer] How to load a QLR file with pyQGIS ?

2015-04-15 Thread Gary Sherman

On 4/15/15 2:24 AM, Geo DrinX wrote:

Hello,


there is a way to load a QLR file with  pyQGIS ?

I tried using  vlayer.loadNamedStyle(qlrFileName)but it seems
not to work.


What is the correct way ?

That is the correct way. Have you done the following after applying the 
style?:


vlayer.triggerRepaint()

You can test the result of applying the style using:

result = vlayer.loadNamedStyle(qlrFileName)

If result if False, the style was not loaded/applied.

-gary



Thank you

Roberto


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer



--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Gary Sherman

Founder, QGIS Project
Consulting: geoapt.com
Publishing: locatepress.com

We work virtually anywhere
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Customized VectorLayer for ArcGIS REST API Connector

2015-04-15 Thread Carmelo Schumacher
Hi Devs

I am currently working on the ArcGIS REST API Connector Plugin[1] trying to 
find a way to use QgsVectorLayer. The webservice (callef ArcGIS Feature 
Service) returns valid GeoJSON and the QgsVectorLayer's datasource url can 
point to the service that provides this GeoJSON (this is done in the current 
version of the plugin). The problem is that there exists no query to retrieve 
all features from an ArcGIS Feature Layer at once/in one service call (if there 
are more than 1000 features). 

So my approach is the following: The feature list is populated through multiple 
service calls and temporarily stored/cached as GeoJSON-File. The 
QgsVectorLayer's datasource url points to this file. The file is repopulated 
occasionally on request/event. Probably the best way to achieve this would be 
to write a CustomVectorDataProvider that inherits from VectorDataProvider and 
is injected into the VectorLayer. But I didn't find a way to do this with 
PyQGIS.  

I then tried to use a QgsPluginLayer as an adapter to a QgsVectorLayer. The 
CustomPluginLayer would hold a reference to an instance of VectorLayer and 
delegates all the functionality of a VectorLayer to this instance. This would 
allow the (re)population of the local GeoJSON file, when the layer is loaded or 
refreshed. But I didn't find a way to achieve this. 

1. What actions are possibly needed to (re)connect? 
2. Or are there methods/structures missing in the Python API wrapper to QGIS 
C++ API?
3. Is there a good overview/doc over the activities/instances involved when an 
VectorLayer is added to a map by calling 
QgsMapLayerRegistry.instance().addMapLayer(layer) or alternatively when a 
VectorLayer is created/added through iface.addVectorLayer? 

Any input/ideas would be very much appreciated. 

Kind regards
Carmelo Schumacher

[1] http://giswiki.hsr.ch/QGIS_ArcGIS_REST_API_Connector_Plugin 
http://giswiki.hsr.ch/QGIS_ArcGIS_REST_API_Connector_Plugin


Carmelo Schumacher
Institut für Software (IFS)
Hochschule für Technik Rapperswil 
Oberseestrasse 10, 8640 Rapperswil, CH___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Project on DB

2015-04-15 Thread Paolo Cavallini
Il 14/04/2015 21:44, Régis Haubourg ha scritto:
 Hmm, interesting idea. 
 By now, I could deal with it with profile QGIS2.ini fine tuning.  
 User settings also concerns all that is stored in .qgis profile (settings,
 GUIncustomization, processing conf and use models).
 
 What you suggest implies that QGIS can authenticate itself and register to a
 DB. We would need then to add some LDAP or CAS to QGIS.

I'm thinking to an option, similar to --configpath, so that qgis starts
authenticating itself against an existing DB, using the authentication
from the system (e.g. Active Directory, etc.).

 I remember Larry was working on related topics.

Right; Larry, what is the current state of art?

   Another point, I guess that we should before conclude on a long running
 topic, the one about refactoring qgs file so that it can store additional
 resources such as data stored along the project, svg resources, scripts. 
  This would hep defining what is a full profile and what is exactly a
 project file.  

This is nice, but it can evolve in parallel: once the double option
(.qgs and db) is in place, any additional info can be added to both.

All the best.

-- 
Paolo Cavallini - www.faunalia.eu
QGIS  PostGIS courses: http://www.faunalia.eu/training.html
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer