Expression to Select Even or Odd Rows in QGIS shapefile

3,335 views
Skip to first unread message

sri...@tumut.nsw.gov.au

unread,
Nov 24, 2015, 6:18:37 PM11/24/15
to Australian and New Zealand QGIS User Group
I have used the Create Points Along Lines PlugIn to create a new point layer with points at 10m intervals along the edge of a street. I have used the Update Column command and @rownum expression to create and populate a RowNumber column. I now want to select and retain only the even values. Can someone please help me out with an Expression for this? I want to use to even numbers as possible address points in a street where addressing is incorrect. And conversely on the other side will use an expression for odd rows. Thanks.

Phil (The Geek) Wyatt

unread,
Nov 24, 2015, 8:02:43 PM11/24/15
to australian-qg...@googlegroups.com

Hi sridley,

 

try selecting with an expression like RowNumber % 2 = 0 - this should select all the even rows and then you can save that as a new file RowNumber % 2 <>0 should get all the odd rows

 

Cheers - Phil

--
You received this message because you are subscribed to the Google Groups "Australian and New Zealand QGIS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to australian-qgis-use...@googlegroups.com.
To post to this group, send email to australian-qg...@googlegroups.com.
Visit this group at http://groups.google.com/group/australian-qgis-user-group.
To view this discussion on the web, visit https://groups.google.com/d/msgid/australian-qgis-user-group/6ec95cb8-c28b-493a-8b8d-1eeb3fee10fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sri...@tumut.nsw.gov.au

unread,
Nov 24, 2015, 11:01:13 PM11/24/15
to Australian and New Zealand QGIS User Group
Thanks Phil, it worked perfectly. I appreciate your help. Sue


On Wednesday, November 25, 2015 at 12:02:43 PM UTC+11, tastrax wrote:

Hi sridley,

 

try selecting with an expression like RowNumber % 2 = 0 - this should select all the even rows and then you can save that as a new file RowNumber % 2 <>0 should get all the odd rows

 

Cheers - Phil

 

 

From: australian-qg...@googlegroups.com [mailto:australian-qgis-user-gr...@googlegroups.com] On Behalf Of sri...@tumut.nsw.gov.au
Sent: Wednesday, 25 November, 2015 10:19 AM
To: Australian and New Zealand QGIS User Group
Subject: [Aus-NZ-QGIS-group] Expression to Select Even or Odd Rows in QGIS shapefile

 

I have used the Create Points Along Lines PlugIn to create a new point layer with points at 10m intervals along the edge of a street. I have used the Update Column command and @rownum expression to create and populate a RowNumber column. I now want to select and retain only the even values. Can someone please help me out with an Expression for this? I want to use to even numbers as possible address points in a street where addressing is incorrect. And conversely on the other side will use an expression for odd rows. Thanks.

--
You received this message because you are subscribed to the Google Groups "Australian and New Zealand QGIS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to australian-qgis-user-group+unsub...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages