[Qgis-user] Selecting polygons on attribute - Trying OGR

Zoltan Szecsei zoltans at geograph.co.za
Tue Jul 24 08:11:21 PDT 2012


On 2012/07/24 17:07, Micha Silver wrote:
> On 07/24/2012 05:52 PM, Zoltan Szecsei wrote:
>> On 2012/07/24 16:41, Micha Silver wrote:
>>> On 07/24/2012 03:10 PM, Zoltan Szecsei wrote:
>>>> Hi,
>>>> I have a SHP file of some 1.1m polygons, of which I need to select 
>>>> about half of them, and save them as a separate SHP file.
>>>>
>>>> The trouble is when I select either via a Query, or via the TABLE 
>>>> using the select options below, it just falls asleep (100% CPU (ok, 
>>>> 12% as it must be single-threaded)).
>>>> After 45 minutes or so, I just kick it out and weep.
>>>>
>>>> My platform is Win 7 Prof 64 bit (also tried on 32 bit) and using 
>>>> 1.8.0 Lisboa.
>>>>
>>>> The selects I have tried are: "sq21code" = "C016*"   and also tried 
>>>> using "IN"
>>>>
>>>> Any ideas what I am doing wrong and what I should try next?
>>>>
>>>
>>> In addition to Andre's correction about the * wildcard, with 1M 
>>> polygons, you probably should move the shapefile into a database 
>>> (i.e spatialite, PostGIS)
>>
>> That would be a bit sad (in terms of extra steps).
>> I'm trying with ogr on Linux, but haven't fiddled the correct syntax yet:
>>
>> zls at gs0:~$ ogr2ogr -where " 21DigitKey LIKE 'C016%' " zerf 
>> /mnt/geo_lvm0/SGO_cadastral/200909/WC/Erf.shp
>> ERROR 1: SQL Expression Parsing Error: syntax error
>> FAILURE: SetAttributeFilter( 21DigitKey LIKE 'C016%' ) failed.
>> zls at gs0:~$
>>
>
> This worked for me (on a *very* small shapefile. Some of the "Name" 
> attributes where "rest  1", "rest 2" etc):
>
> ogr2ogr -f "ESRI Shapefile" -where "Name LIKE 'Rest%'" waypoints3.shp 
> waypoints.shp
Still no:
zls at gs0:~$ ogr2ogr -f "ESRI Shapefile" -where " 21DigitKey LIKE 
'C016%'"      zerf.shp /mnt/geo_lvm0/SGO_cadastral/200909/WC/Erf.shp
ERROR 1: SQL Expression Parsing Error: syntax error
FAILURE: SetAttributeFilter( 21DigitKey LIKE 'C016%') failed.
zls at gs0:~$

21igitKey BTW is "String" 60


>
>
>>>
>>>> Thanks & regards,
>>>> Zoltan
>>>>
>>>>
>>>>
>>>
>>>
>>> -- 
>>> Micha Silver
>>> GIS Consultant, Arava Development Co.
>>> http://www.surfaces.co.il
>>
>>
>> -- 
>>
>> ===========================================
>> Zoltan Szecsei PrGISc [PGP0031]
>> Geograph (Pty) Ltd.
>> P.O. Box 7, Muizenberg 7950, South Africa.
>>
>> 65 Main Road, Muizenberg 7945
>> Western Cape, South Africa.
>>
>> 34° 6'16.35"S 18°28'5.62"E
>>
>> Tel: +27-21-7884897  Mobile: +27-83-6004028
>> Fax: +27-86-6115323www.geograph.co.za
>> ===========================================
>>
>>
>> This mail was received via Mail-SeCure System.
>
>
> -- 
> Micha Silver
> GIS Consultant, Arava Development Co.
> http://www.surfaces.co.il


-- 

===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
P.O. Box 7, Muizenberg 7950, South Africa.

65 Main Road, Muizenberg 7945
Western Cape, South Africa.

34° 6'16.35"S 18°28'5.62"E

Tel: +27-21-7884897  Mobile: +27-83-6004028
Fax: +27-86-6115323     www.geograph.co.za
===========================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120724/4ee8dc31/attachment.html>


More information about the Qgis-user mailing list