Feature request #8766

Atlas current feature filter

Added by David McDermott about 11 years ago. Updated about 11 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Map Composer/Printing
Pull Request or Patch supplied:No Resolution:fixed/implemented
Easy fix?:No Copied to github as #:17472

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 KB) Nathan Woodrow, 2013-11-07 03:14 AM

atlas_exp.png (27 KB) David McDermott, 2013-11-11 04:20 AM

atlas_on.png (19.4 KB) David McDermott, 2013-11-11 04:20 AM

qgis_version.png (35.8 KB) David McDermott, 2013-11-11 05:30 AM

Associated revisions

Revision bff6fe59
Added by Nathan Woodrow about 11 years ago

Set currentfeature expression variable for Atlas printing. Fix #8766

History

#1 Updated by Giovanni Manghi about 11 years ago

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

#2 Updated by Anonymous about 11 years ago

  • Status changed from Open to Closed

#3 Updated by Nathan Woodrow about 11 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:

#4 Updated by Regis Haubourg about 11 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

#5 Updated by Nathan Woodrow about 11 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

#6 Updated by Mathieu Pellerin - nIRV about 11 years ago

kudos Nathan, that's very useful

#7 Updated by Regis Haubourg about 11 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 ?

#8 Updated by David McDermott about 11 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.

#9 Updated by Nathan Woodrow about 11 years ago

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

#10 Updated by David McDermott about 11 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.

#11 Updated by Nathan Woodrow about 11 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.

#12 Updated by David McDermott about 11 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

#13 Updated by Nathan Woodrow about 11 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

#14 Updated by Regis Haubourg about 11 years ago

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

#15 Updated by Nathan Woodrow about 11 years ago

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

#16 Updated by Regis Haubourg about 11 years ago

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

#17 Updated by Regis Haubourg about 11 years ago

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

#18 Updated by Jürgen Fischer about 11 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.

#19 Updated by Regis Haubourg about 11 years ago

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

#20 Updated by Jürgen Fischer about 11 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.

#21 Updated by Regis Haubourg about 11 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.

#22 Updated by Nathan Woodrow about 11 years ago

Can you paste a image of your about QGIS dialog.

#23 Updated by Regis Haubourg about 11 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 PDF