[Qgis-developer] Extending QgsMapToolIdentify andQgsIdentifyResults

Byambaa Mendbayar mendbayar_b at mongol.net
Wed Jan 31 23:48:09 EST 2007

Dear Martin Dobias and Peter Ersts,

I am glad to hear extending QgsMapToolIdentify within QgsIdentifyResults. I
like your idea. 

I have some idea for few plug-ins. One of them requires user assigned extend
coordinate select by mouse click event on the map canvas. Actually this
plug-in will be used raster image warping like as gdalwarp util. 

Feel a free to advice and helping to me for above plug-ins work.

P.S I'm looking forward to see the suggestion and patches from you on
QgsMapToolIdentify and QgsIdentifyResults.

Byambaa Mendbayar

-----Original Message-----
From: qgis-developer-bounces at lists.qgis.org
[mailto:qgis-developer-bounces at lists.qgis.org] On Behalf Of Peter Ersts
Sent: Saturday, January 27, 2007 5:41 AM
To: Martin Dobias
Cc: qgis-developer at lists.qgis.org
Subject: Re: [Qgis-developer] Extending QgsMapToolIdentify


For the most part the results that are displayed now are sufficient but 
here is a list of things that could be useful

All Results to include:
Map coordinate (projected)
Map coordinate (geographic)
Display coordinates, i.e., X,Y within the display (lower priority)
Layer type

Vector Specific:
Feature ID + all associated attributes (table values)
length or area of feature if not already in table (lower priority)

Raster Specific:
Pixel Coordinate
Pixel values (all bands)
Pixel count (for classified/categorical data)

WMS Specific:

For simplicity the result set could include more meta-data type 
information about the layer, but that is not necessarily needed as that 
information is readily available using QgsInterface::getActiveLayer(). 
For the actual storage of the results an xml document would be robust, 
but could add a little overhead.  Or, for everything but the vector 
feature attributes and the pixel values, a simple struct could be used. 
Vector feature and Pixel values could be a QList of another struct that 
is just an attribute name and value, so for raster it would be 
attribute=Band1 value=50 etc.

Anyway, thanks for thinking about this. I know there are a lot of other 
things to do but I think this would be a useful modification that would, 
for example, allow a plugin to respond differently to points based on a 
particular attribute i.e., loading an external file (path/url in 
attribute) with the correct application (depending the file type stored 
in another attribute). 


Martin Dobias wrote:
> Hi Peter,
> your idea sounds good for me. But could you explain how should
> QgsIdentifyResult object look like? I mean what will be its contents
> for vector/raster layers - e.g. only feature ID (for vector layers)
> and cell coordinate (for raster layers) or whether it will contain
> also more information etc.
> Martin
> On 1/26/07, Peter Ersts <ersts at amnh.org> wrote:
>> Dear Developers,
>> I was wonder if it would be possible to disassociate the
>> QgsIdentifyResults from a QWidget? My suggestions is to make
>> QgsIdentifyResults a more generic object. This would allow for any class
>> (or plugin) to implement QgsMapToolIdentify. The QgsMapToolIdentify
>> mouse event would simply return a QgsIdentifyResult object that could
>> then be displayed by the user or used to obtain attributes for the
>> feature or pixel at the screen/map coordinates.
>> For example, I have been working on some modifications to the
>> QgsRasterLayer and QgsRasterLayerProperties classes (and gui) to allow
>> for basic stretching and multiple user defined transparency values.  One
>> of the feature that was suggested was to have a "Identify Features" like
>> tool to populate the transparency tables. In this example, the user
>> would press a button "Add Values From Display" which I would like to
>> launch a QgsMapToolIdentify like feature, but return the results as a
>> simple object to QgsRasterLayerProperties.  QgsRasterLayerProperties
>> would then use the results to populate a table in gui rather than simply
>> display the pixel values in another dialog.
>> This would also allow users to inherit and extend the functionality of
>> QgsMapToolIdentify. It seems like it should not be to difficult, but I
>> may be missing something here.
>> cheers,
>> -pete

Peter J. Ersts, Project Specialist
American Museum of Natural History
Center for Biodiversity and Conservation
Central Park West at 79th Street
New York, New York 10024
Tel: (212)-496-3488 or (212)-769-5742
Fax: (212)-313-7295 or (212)-769-5292
Web: http://cbc.amnh.org

Visit the Indo-South Atlantic Consortium on Humpback Whales 
Web:  http://www.isach.org

Qgis-developer mailing list
Qgis-developer at lists.qgis.org

More information about the Qgis-developer mailing list