<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=windows-1255"
      http-equiv="Content-Type">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="preferred-charset"
    bgcolor="#FFFFFF" text="#000000">
    On 07/24/2012 05:52 PM, Zoltan Szecsei wrote:
    <blockquote cite="mid:500EB692.2070907@geograph.co.za" type="cite">
      <meta content="text/html; charset=windows-1255"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 2012/07/24 16:41, Micha Silver
        wrote:<br>
      </div>
      <blockquote cite="mid:500EB40F.1080100@arava.co.il" type="cite">
        <meta content="text/html; charset=windows-1255"
          http-equiv="Content-Type">
        <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
        On 07/24/2012 03:10 PM, Zoltan Szecsei wrote:
        <blockquote cite="mid:500E90D3.6090206@geograph.co.za"
          type="cite">Hi, <br>
          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. <br>
          <br>
          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)). <br>
          After 45 minutes or so, I just kick it out and weep. <br>
          <br>
          My platform is Win 7 Prof 64 bit (also tried on 32 bit) and
          using 1.8.0 Lisboa. <br>
          <br>
          The selects I have tried are: "sq21code" = "C016*"   and also
          tried using "IN" <br>
          <br>
          Any ideas what I am doing wrong and what I should try next? <br>
          <br>
        </blockquote>
        <br>
        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)<br>
      </blockquote>
      <br>
      That would be a bit sad (in terms of extra steps).<br>
      I'm trying with ogr on Linux, but haven't fiddled the correct
      syntax yet:<br>
      <br>
      <tt>zls@gs0:~$ ogr2ogr -where " 21DigitKey LIKE 'C016%' "     
        zerf /mnt/geo_lvm0/SGO_cadastral/200909/WC/Erf.shp<br>
        ERROR 1: SQL Expression Parsing Error: syntax error<br>
        FAILURE: SetAttributeFilter( 21DigitKey LIKE 'C016%' ) failed.<br>
        zls@gs0:~$<br>
      </tt><br>
    </blockquote>
    <br>
    This worked for me (on a *very* small shapefile. Some of the "Name"
    attributes where "rest  1", "rest 2" etc):<br>
    <br>
    ogr2ogr -f "ESRI Shapefile" -where "Name LIKE 'Rest%'"
    waypoints3.shp waypoints.shp<br>
    <br>
    <br>
    <blockquote cite="mid:500EB692.2070907@geograph.co.za" type="cite">
      <blockquote cite="mid:500EB40F.1080100@arava.co.il" type="cite"> <br>
        <blockquote cite="mid:500E90D3.6090206@geograph.co.za"
          type="cite">Thanks & regards, <br>
          Zoltan <br>
          <br>
          <br>
          <br>
        </blockquote>
        <br>
        <br>
        <pre class="moz-signature" cols="72">-- 
Micha Silver
GIS Consultant, Arava Development Co.
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></pre>
      </blockquote>
      <br>
      <br>
      <pre class="moz-signature" cols="72">-- 

===========================================
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     <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.geograph.co.za">www.geograph.co.za</a>
===========================================</pre>
      <br>
      <br>
      This mail was received via Mail-SeCure System.<br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Micha Silver
GIS Consultant, Arava Development Co.
<a class="moz-txt-link-freetext" href="http://www.surfaces.co.il">http://www.surfaces.co.il</a></pre>
  </body>
</html>