title: How to use mapnik + shapefiles with dynamically filtered results without PostgreSQL or manual changes to the dbf file?
body: <p>I have an unusual challenge that I'm struggling with. I'm hoping someone has come across this and can point me towards a solution.</p>
  
  <p><strong>Overview:</strong></p>
  
  <p>I am searching for a way to use mapnik + shapefiles with dynamically filtered results without PostgreSQL or manual changes to the dbf file.</p>
  
  <p><strong>Details:</strong></p>
  
  <p>I need to draw territories made up of ZIP codes on a map. My current solution pulls polys from a MySQL database and draws them on a Google Map at runtime. This is obviously very slow. I'd prefer to move this to a mapnik-compatible solution so I can render the tiles on the fly and have the maps respond much more quickly.</p>
  
  <p>Now, before you say, just use Postgres instead of shapefiles, let me say that this server doesn't and can't have Postgres on it. It sucks, but it's a hard limitation. The dynamic data source is MySQL which mapnik doesn't support.</p>
  
  <p>I can, of course, render these territories manually offline (I happen to use TileMill for this). To do so, I must manipulate the shapefile's dbf file in OpenOffice by adding a simple column that flags if a ZIP is in a territory or not and to whom it belongs. Then in my CartoCSS, it's a simple matter of looking for [INCLUDE="Y"] { ... } to draw or hide the poly, and a simple color assignment based on the territory owner's id. No problem there except for the fact that this is incredibly time- and labor-intensive.</p>
  
  <p>The real problem is that the client has nearly a hundred territories that change from time to time. To make matters worse, when they change, a ripple effect can cause a chain reaction whereby neighboring territories change. And to make matters even worse, they don't want the the territory owners to see each others' territories, meaning each territory has to be filtered and drawn in isolation.</p>
  
  <p>So, I'm looking for an automated hybrid solution to handle the filtering the shapefile so I don't have to redo this by hand every time the territories change.</p>
  
  <p>My hair is turning gray on this one. I'm open to options so long as the solution doesn't rely on PostgreSQL or manual manipulation of the shapefile's dbf database.</p>
  
  <p>Any help and advice is much appreciated.</p>
  
  <p>Thanks,
  Steve</p>
  
  <p><strong>TLDR: I need to use mapnik + shapefiles with dynamically filtered results without PostgreSQL or manual changes to the dbf file</strong></p>