<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="#660000">
    <div class="moz-cite-prefix">On 11/07/2012 03:34,
      <a class="moz-txt-link-abbreviated" href="mailto:rhoskins@u.washington.edu">rhoskins@u.washington.edu</a> wrote:<br>
    </div>
    <blockquote
      cite="mid:alpine.LRH.2.01.1207101734350.13769@hymn14.u.washington.edu"
      type="cite">
      <pre wrap="">I need to estimate the population of post codes by doing an areal overlay with smaller census tracts over the
postal codes.

How is this done in QGIS?
</pre>
    </blockquote>
    This kind of aggregate job is probably best done right in a
    database. You can import both vectors into a spatialite database,
    add a column for the population in the post_codes table, then run a
    SUM query such as:<br>
    <font face="Courier New, Courier, monospace"><br>
      .loadshp 'post codes' post_codes  LATIN1  <your coordinate
      system SRID> ;<br>
      .loadshp 'census_tracts' census_tracts LATIN1  <coordinate
      SRID> ;<br>
      <br>
      ALTER TABLE post_codes ADD COLUMN population integer;<br>
      <br>
      UPDATE post_codes SET population=SUM(census_tracts.population)<br>
      WHERE Intersects(post_codes.Geometry, census_tracts.Geometry)<br>
      GROUP BY post_codes.zip;<br>
      <br>
    </font>If you have a large number of census tracts, you'll most
    likely want to add a Spatial Index and use it in the query to speed
    things up.<br>
    <br>
    HTH,<br>
    Micha<br>
    <br>
    <br>
    <blockquote
      cite="mid:alpine.LRH.2.01.1207101734350.13769@hymn14.u.washington.edu"
      type="cite">
      <pre wrap="">
Thanks -

R Hoskins
Anchorage, AK 


_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>

This mail was received via Mail-SeCure System.


</pre>
    </blockquote>
    <font size="+1"></font><br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Micha Silver
052-3665918
</pre>
  </body>
</html>