[Qgis-developer] Re: error during linking{solved}

2010-11-09 Thread sunil

HI 
 I solved the  error which i was mentioned above , i didnt give right path
for "SETUPAPI_LIBRARY", after i gave the error got resolved , but i got
another error as 


"Linking CXX shared library libqgis_analysis.dll
Creating library file: libqgis_analysis.dll.a
[ 64%] Built target qgis_analysis
[ 65%] Generating analysis/sipanalysispart0.cpp,
analysis/sipanalysispart1.cpp,
analysis/sipanalysispart2.cpp, analysis/sipanalysispart3.cpp

sip: C:/msys/local/src/qgis-1.5.0/python/core/conversions.sip:271: Mapped
type h
as already been defined in another module
mingw32-make[2]: *** [python/analysis/sipanalysispart0.cpp] Error 1
mingw32-make[1]: *** [python/CMakeFiles/python_module_qgis_analysis.dir/all]
Err
or 2
mingw32-make: *** [all] Error 2"

could u plz help 
regards 
sunil





-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/error-during-linking-tp5696331p5723585.html
Sent from the qgis-developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Continuous Color style

2010-11-09 Thread Luca Delucchi
Hi everybody, I'm working on OGR2Layers python plugin, I'd like to
implement also continuous color style, but I didn't understand how can
I assign a style to each features. With also style type like unique
value or graduated I had all the classes of style (symbols class) with
continuous color I had only the first (min value) and the last (max
value), is there some mathematical functions for calculate the
intermediate classes?

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


Re: [Qgis-developer] Qgis Api - select all features of a vector layer

2010-11-09 Thread kimaidou
Thanks for this answer

2010/11/9 Carson Farmer 

> ...and with the newer PyQGIS API, we can do things even more Pythonically:
>
>
Is the new api usable from 1.5, or should I wait for the next version ?


> def layerIds(layer):
> layer.select([]) # we don't actually need the attributes
>ids = [feat.id() for feat in layer]
> return ids
>
> Obviously you could skip the step of creating the layerIds function,
> and then you'd reduce the entire thing down to:
>
> layer = self.iface.mapCanvas().currentLayer() # or however else you
> get the layer
> layer.select([]) # we don't actually need the attributes
> layer.setSelectedFeatures([feat.id() for feat in layer]) # select all
> the feature ids
>

Yes , it is more concise and the list comprehension is much more pythonistic
;)
I was on other php projects, and lost my python :)


>
> My guess is that this would be quite a bit faster than boundingbox
> method, especially because select(QgsRectangle, bool) actually
> contains this:
>
> QgsFeature f;
> while ( nextFeature( f ) )
> {
>  select( f.id(), false );
> }
>
>
Ok. Thanks again !

> whereas setSelectedFeatures is more direct.
>
> Carson
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Qgis Api - select all features of a vector layer

2010-11-09 Thread Carson Farmer
...and with the newer PyQGIS API, we can do things even more Pythonically:

def layerIds(layer):
    layer.select([]) # we don't actually need the attributes
ids = [feat.id() for feat in layer]
    return ids

Obviously you could skip the step of creating the layerIds function,
and then you'd reduce the entire thing down to:

layer = self.iface.mapCanvas().currentLayer() # or however else you
get the layer
layer.select([]) # we don't actually need the attributes
layer.setSelectedFeatures([feat.id() for feat in layer]) # select all
the feature ids

My guess is that this would be quite a bit faster than boundingbox
method, especially because select(QgsRectangle, bool) actually
contains this:

QgsFeature f;
while ( nextFeature( f ) )
{
  select( f.id(), false );
}

whereas setSelectedFeatures is more direct.

Carson

On 9 November 2010 16:46, Barry Rowlingson  wrote:
> On Tue, Nov 9, 2010 at 4:22 PM, kimaidou  wrote:
>> Hi again
>>
>> Still working on my python plugin...
>>
>> I need to simply select all the features of a chosen vector layer. In
>> QgsVectorLayer api, there is no method "selectAllFeatures()"
>>
>> So I use this piece of code to achieve it
>> http://osgeo.pastebin.com/Ma9DxgKR
>
>  That's an interesting approach! My selectplus plugin has a 'select
> all' function which does this:
>
>    def doit(self):
>        layer = self.iface.mapCanvas().currentLayer()
>        layer.setSelectedFeatures(layerIds(layer))
>        return None
>
> where layerIds is:
>
> def layerIds(layer):
>    ids = []
>    p = layer.dataProvider()
>    allAttrs = p.attributeIndexes()
>    p.select(allAttrs)
>    f = QgsFeature()
>    while p.nextFeature(f):
>        ids.append(f.id())
>    return ids
>
> Your rectangle overlay should be pretty quick, but maybe my collecting
> all the feature IDs is quicker?
>
> Barry
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation
National University of Ireland, Maynooth,
http://www.carsonfarmer.com/
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Qgis Api - select all features of a vector layer

2010-11-09 Thread kimaidou
Hi again

Still working on my python plugin...

I need to simply select all the features of a chosen vector layer. In
QgsVectorLayer api, there is no method "selectAllFeatures()"

So I use this piece of code to achieve it
http://osgeo.pastebin.com/Ma9DxgKR

* Is there a better way to do so ?
* Do you think a method selectAllFeatures() would be usefull ? If so I will
add it to the trac.

Thx again,

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


Re: [Qgis-developer] Qgis Api - select all features of a vector layer

2010-11-09 Thread kimaidou
2010/11/9 Barry Rowlingson 

>
>  That's an interesting approach! My selectplus plugin has a 'select
> all' function which does this:
>

I love coding : there is never one way to achieve things :)


>
>def doit(self):
>layer = self.iface.mapCanvas().currentLayer()
>layer.setSelectedFeatures(layerIds(layer))
>return None
>
> where layerIds is:
>
> def layerIds(layer):
>ids = []
>p = layer.dataProvider()
>allAttrs = p.attributeIndexes()
>p.select(allAttrs)
>f = QgsFeature()
>while p.nextFeature(f):
>ids.append(f.id())
>return ids
>
> Your rectangle overlay should be pretty quick, but maybe my collecting
> all the feature IDs is quicker?
>

I don't know :) I tried to have a compact code, so I reused the api method
that seemed simplier, in a spatial approach.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] Qgis Api - select all features of a vector layer

2010-11-09 Thread Barry Rowlingson
On Tue, Nov 9, 2010 at 4:22 PM, kimaidou  wrote:
> Hi again
>
> Still working on my python plugin...
>
> I need to simply select all the features of a chosen vector layer. In
> QgsVectorLayer api, there is no method "selectAllFeatures()"
>
> So I use this piece of code to achieve it
> http://osgeo.pastebin.com/Ma9DxgKR

 That's an interesting approach! My selectplus plugin has a 'select
all' function which does this:

def doit(self):
layer = self.iface.mapCanvas().currentLayer()
layer.setSelectedFeatures(layerIds(layer))
return None

where layerIds is:

def layerIds(layer):
ids = []
p = layer.dataProvider()
allAttrs = p.attributeIndexes()
p.select(allAttrs)
f = QgsFeature()
while p.nextFeature(f):
ids.append(f.id())
return ids

Your rectangle overlay should be pretty quick, but maybe my collecting
all the feature IDs is quicker?

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


Re: [Qgis-developer] Qgis Api - get a layer by its name

2010-11-09 Thread kimaidou
Hi Carson,

Thanks for your reply

2010/11/9 Carson Farmer 

> Hi Kimaidou,
>
> I suspect that is how most plugin developers have implemented this
> functionality, and for the most part it works (save for the situations
> you listed below).
>

Ok


 One solution would be use userData to store the layers uniqueID, and
> then use that to access layers later on.
> First you add each layer name to the combobox, like so:
> combobox.addItem ( layer.name(),QVariant(layer.getLayerID()))
>

UniqueId is the best candidate !


>
> and then when the user select a layer from the combobox, get the
> maplayer by doing something like (untested):
> uniqueId = combobox.itemData(combobox.currentIndex()).toString()
> layer = QgsMapLayerRegistry.instance().mapLayer(uniqueId)
>

Ok


>
> Of course, if you are simply listing all layers in the layer list,
> then you could just use their order in the combobox, as this will be
> the same as the order in the layer list.
> layer = mapCanvas.layer(combobox.currentIndex())
>
> Hope that helps,
>

That helps a lot, thanks !

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


Re: [Qgis-developer] Qgis Api - get a layer by its name

2010-11-09 Thread Carson Farmer
Hi Kimaidou,

> I have not found any function in QgsMapLayer for getting a layer by its
> name. I needed it on a python plugin to let the user choose a layer from a
> combo box (already populated with the layer names)
> So I created this function http://osgeo.pastebin.com/7EpNA3JL
I suspect that is how most plugin developers have implemented this
functionality, and for the most part it works (save for the situations
you listed below).
>
> I have some questions regarding it:
> * Is it the right way ?
> * I have seen it is possible in Qgis to rename a layer, and 2 layers of the
> same type can have the same name. This makes my function not working in all
> the cases (which is my problem of course). Is there a reason to allow layers
> to share a name ?

One solution would be use userData to store the layers uniqueID, and
then use that to access layers later on.
First you add each layer name to the combobox, like so:
combobox.addItem ( layer.name(),QVariant(layer.getLayerID()))

and then when the user select a layer from the combobox, get the
maplayer by doing something like (untested):
uniqueId = combobox.itemData(combobox.currentIndex()).toString()
layer = QgsMapLayerRegistry.instance().mapLayer(uniqueId)

Of course, if you are simply listing all layers in the layer list,
then you could just use their order in the combobox, as this will be
the same as the order in the layer list.
layer = mapCanvas.layer(combobox.currentIndex())

Hope that helps,

Carson

-- 
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation
National University of Ireland, Maynooth,
http://www.carsonfarmer.com/
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Qgis Api - get a layer by its name

2010-11-09 Thread kimaidou
Hi List

I have not found any function in QgsMapLayer for getting a layer by its
name. I needed it on a python plugin to let the user choose a layer from a
combo box (already populated with the layer names)
So I created this function http://osgeo.pastebin.com/7EpNA3JL

I have some questions regarding it:
* Is it the right way ?
* I have seen it is possible in Qgis to rename a layer, and 2 layers of the
same type can have the same name. This makes my function not working in all
the cases (which is my problem of course). Is there a reason to allow layers
to share a name ?

Thanks for all the work done in Qgis

Cheers

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


[Qgis-developer] Saving OpenLayers as raster

2010-11-09 Thread Vincent Leong
Hi, I would like to ask the possiblity of saving the google layers we
get from OpenLayers plugin as raster layers.

The OpenLayers plugin is of a great help to me.
And the ability to save those layers for moments without internet
connection would be a great help!!
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


[Qgis-developer] Hackfest last minute

2010-11-09 Thread Milena Nowotarska
Hi to All planning to attend the 4th QGIS Hackfest in Wrocław,

This is the last minute to make up your mind and decide to
participate. We will meet on Thursday, 11th November.

The first, unofficial meeting we plan to start slowly at the Venue
about 15.00-17.00. There you can get familiar with the venue
facilities [1] or have the first coffee and start coding.
The official meeting starts at 10 on Friday 12th at Department of
Climatology and Atmosphere Protection, University of Wroclaw.
The official meeting ends at 18 on Sunday 14th. Participants can
extend meeting to 11 - 15th Nov.

See you soon,
Milena and Paweł

[1] 
http://quantum-gis.pl/_detail/blog/ogrod.jpg?id=blog%3Aqgis_hackfest_venue_wroclaw_2010
-- 
Milena Nowotarska
http://wiki.osgeo.org/wiki/Milena_Nowotarska
http://quantum-gis.pl/     ||     http://grass-gis.pl/
http://www.qgis.org/wiki/4._QGIS_Hackfest_in_Wroclaw_2010
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer