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.
Overview:
I am searching for a way to use mapnik + shapefiles with dynamically filtered results without PostgreSQL or manual changes to the dbf file.
Details:
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.
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.
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.
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.
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.
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.
Any help and advice is much appreciated.
Thanks, Steve
TLDR: I need to use mapnik + shapefiles with dynamically filtered results without PostgreSQL or manual changes to the dbf file