[Qgis-user] Filter shape file with data in text file?

Alister Hood alister.hood at synergine.com
Fri Mar 25 00:03:13 PDT 2011


> Date: Fri, 25 Mar 2011 13:04:20 +0800
> From: Ramon Andinach <custard at westnet.com.au>
> Subject: [Qgis-user] Filter shape file with data in text file?
> To: qgis-user <qgis-user at lists.osgeo.org>
> Message-ID: <594955F2-174E-4121-A6A4-EF45C14BC967 at westnet.com.au>
> Content-Type: text/plain; charset=us-ascii
> 
> Hello,
> 
> I'm wondering if someone could point me in the right direction for a
solution
> to this situation.
> 
> I have a shapefile with a large number of polygons (in this case
mining
> leases).
> I have a text file that contains a list of tenements of interest.
> I'd like to end up with a second shape file that only has the polygons
shown in
> that text file.
> 
> I could do it by setting up a series of filters in the General tab,
but after
> about the 20th TenementID = "fish" AND "TenementID = "finger" it gets
a little
> tedious.
> The tenements are not adjacent to each other so I can't really go
through and
> do an area search.
> 
> I have tried pulling the text file in (via delimited text) and joining
the
> shapefile to it, but had errors with saving (I think because it
thought it had
> polygons that it was trying to put in a point file.)

What was the error message?  The other likely one would be because you
have field
names with more than 10 characters.

> I was not able to try it the other way around (join text to shape).
> 
> Does anyone have any thoughts?
> -ramon.

Hi Ramon,
The delimited text plugin requires you to choose easting and northing
columns, 
so naturally it does create a point layer.  
Try saving the .csv file as a .dbf.  You can do this with e.g.
Openoffice.org 
or an old version of Excel.  Then you can select the .dbf file when you
use 
"Vector-Join attributes".  
Alternatively, if you are running a nightly QGIS build (1.7), you should
be able 
to add the .csv without geometry, by dragging and dropping it into the
layer 
control, and then use the new "Joins" tab in "Layer Properties" for the
polygon 
layer.  

Regards, 
Alister



More information about the Qgis-user mailing list