Storing MapFile objects in SQL database

Etienne Dube etdube at GMAIL.COM
Wed May 10 23:29:36 EDT 2006


Hi everybody,

Is there a straightforward way to store MapFile objects in a relational 
database? I'm working on a project using MapServer, Chameleon and 
PostgreSQL+PostGIS, and I need to do some rather funky things when 
displaying maps. For example, we have a database with many different 
classes of measures taken at various sites. Indicators can be 
dynamically calculated from one or many measures (with SQL queries) and 
used for thematic mapping. Each indicator has its own classes for 
symbology, so what I'm doing now is creating a layer with the associated 
classes for each one.

Needless to say, my MapFiles get unwieldy pretty fast, with lots of 
redundant definitions (same class labels and styles repeated in each 
layer). I don't even need to display more than one indicator at a time, 
in fact it'd be better if I could offer a drop-down box to choose which 
one to map (I've already been able to implement similar functionality in 
parameterizable queries handled with some PHP and Mapscript kung-fu for 
choosing the data's year, so I figure I should be able to do the same 
for pretty much any object accessible by Mapscript).

I'm thinking about storing all the NAME, DATA (pulling stuff from pgSQL 
with queries), *SCALE, CLASS, LABEL and STYLE items in the database 
(pgSQL) for my indicator "layers", so it's easier to manage and use 
along with PHP/Mapscript. I was wondering if anybody has done the same 
thing before. Is there any open-source code available meant to do 
something similar? If not, are there any known issues or pitfalls with 
such an approach?

Thanks in advance,

Etienne



More information about the mapserver-users mailing list