Feature request #8766

Atlas current feature filter

Added by David McDermott over 3 years ago. Updated over 3 years ago.

Status:Closed Start Date:10/04/2013
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:Map Composer / Printing
Target version:Future Release - Nice to have
Platform: Resolution:fixed/implemented
Platform version: Pull Request or Patch supplied:No
Status info: Tag:

Description

Good morning to the QGIS community,

First off, thank you for QGIS 2.0.1, its a great piece of software and the GUI is fantastic. I have been looking forward to the atlas integration for a long time but I don't think it's quite there yet. When I print map books, I often have features close together. What I would like Atlas to do is apply a filter so that only the current feature is visible (or all features expect the current is visible). What I envisage is a feature similar to ESRIs data driven pages, page definition queries (http://tinyurl.com/p5ptq28).

I posted this request in the User Forum (http://tinyurl.com/puvazlh) but Vincent Picavet suggested I post it here. I'm not sure if this is already possible. I have tried several iteration in the feature filter dialog such as $feature=$feature or $rownum=$rownum with no success. The expression $feature=$currentfeature (if there was a $currentfeature) might work. On a layer by layer basis, a tick box in the layer filter option called "atlas filtering" might also be an option.

Thanks,

David

output_1.jpg (186.1 kB) Nathan Woodrow, 11/07/2013 03:14 am

atlas_exp.png (27 kB) David McDermott, 11/11/2013 04:20 am

atlas_on.png (19.4 kB) David McDermott, 11/11/2013 04:20 am

qgis_version.png (35.8 kB) David McDermott, 11/11/2013 05:30 am

Associated revisions

Revision bff6fe5913f2666b5d90cea47ae062b429604a22
Added by Nathan Woodrow over 3 years ago

Set currentfeature expression variable for Atlas printing. Fix #8766

History

Updated by Giovanni Manghi over 3 years ago

  • Category set to Map Composer / Printing
  • Target version set to Future Release - Nice to have

Updated by Anonymous over 3 years ago

  • Status changed from Open to Closed

Updated by Nathan Woodrow over 3 years ago

  • File output_1.jpg added
  • Resolution set to fixed/implemented

Now that we have $currentfeature we can match that in a rule to highlight the active Atlas feature.

Result:

Updated by Regis Haubourg over 3 years ago

Hi, I was about to ask the same feature! So great.. The idea was to be able to filter labeling only in currentfeature with a intersect clause.
Having another feature simplified on the current scale (with new simplification improvement by A.Huarte and V.Mora) would avoid performances issues with big polygons.. My two cents.
Régis

Updated by Nathan Woodrow over 3 years ago

Regis,

You could do this in using a CASE in a label expression (for now)

CASE
WHEN $id = $currentfeature THEN "yourlabel"
END

You could even use a case statement in the transparency property to get something like this.

CASE
WHEN $id != $currentfeature THEN 50
END

Updated by Mathieu Pellerin - nIRV over 3 years ago

kudos Nathan, that's very useful

Updated by Regis Haubourg over 3 years ago

Nathan Woodrow wrote:

Regis,

You could do this in using a CASE in a label expression (for now)

@CASE WHEN $id = $currentfeature THEN "yourlabel" END@

Hi Nathan,
that works only for Atlas coverage layer right ?

Updated by David McDermott over 3 years ago

Thank you Nathan, this is perfect. How do I go about implementing this fix? I downloaded and installed the most recent (10/11/13) version of QGIS but there is no $Currentfeature function.

Updated by Nathan Woodrow over 3 years ago

Have you enabled Atlas in the composer. It will only be active then.

Updated by David McDermott over 3 years ago

Atlas composer is active, and I have the $feature function. I took your idea and put ($feature + 1) = $id in the style expression and it works. I have added a few photos.

Updated by Nathan Woodrow over 3 years ago

I wouldn't use $feature + 1 because $feature is just a count and $id is not ordered or can having missing numbers so this expression will fail.

Can you QGIS Code revision you have in your About dialog.

Updated by David McDermott over 3 years ago

My $feature+1 $id was just a temporary workaround that worked on this dataset. The code version is ebebdf3. Here is a screen shot

Updated by Nathan Woodrow over 3 years ago

Oh your still running 2.0. You will have to grab a nightly build if you want this feature. You can get the nighly dev version using the OSGeo4W installers at http://qgis.org/en/site/forusers/download.html

Updated by Regis Haubourg over 3 years ago

Hi Nathan,
I can't see $currentfeature variable in latest revision on OSGEO4W (5f5cd4c) , with Atlas enabled..
Any idea? OSGEO4W is late?

Updated by Nathan Woodrow over 3 years ago

Very old. Are you using the OSGeo4W of the qgis site?

Updated by Regis Haubourg over 3 years ago

Yep, updated osgeo4w 64 bit today. Will check 32 bit now...

Updated by Regis Haubourg over 3 years ago

Hum, in fact 32 bit package is realy old, 64 bit is up to 2.1.0-60

Updated by Jürgen Fischer over 3 years ago

regis Haubourg wrote:

Hum, in fact 32 bit package is realy old, 64 bit is up to 2.1.0-60

What do you mean? The packages both are from today.

Updated by Regis Haubourg over 3 years ago

In my 32 bit osgeo4w installer, I get 2.1.0-55 where I get -60 in 64 bits version.

Updated by Jürgen Fischer over 3 years ago

regis Haubourg wrote:

In my 32 bit osgeo4w installer, I get 2.1.0-55 where I get -60 in 64 bits version.

Right, but that doesn't mean they contain different QGIS versions. Just that the 32bit version wasn't built successfully as many many times as the 64bit version.

Updated by Regis Haubourg over 3 years ago

Ok, didn't know that. Anyway, it seems nathan's code is not functionnal in 32 bit package. Maybe other reasons explain that.

Updated by Nathan Woodrow over 3 years ago

Can you paste a image of your about QGIS dialog.

Updated by Regis Haubourg over 3 years ago

here is what I see:

Version de QGIS 2.0.1-Dufour Révision du code ebebdf3
Compilé avec Qt 4.7.1 Utilisant Qt 4.7.1
Compilé avec GDAL/OGR 1.10.1 Utilisé avec GDAL/OGR 1.10.1
Compiled against GEOS 3.3.8-CAPI-1.7.8 Running against GEOS 3.4.2-CAPI-1.8.2 r3921
Version du client PostgreSQL 8.3.10 Version de SpatiaLite 4.1.1
Version de QWT 5.2.1 Version de PROJ.4 : 480
Version de QScintilla2 2.6.2

Also available in: Atom