XML Mapfiles... are we looking to far?

Julien, Heryk hjulien at NRCAN.GC.CA
Wed Jul 19 14:04:00 EDT 2006

I made a first try at creating an xml mapfile schema (xsd) this morning. It's not finished yet but the general idea is there... I just wanted to have your comments before pushing on. I used the same element names as in the text mapfile. This will permit us to write a stylesheet (xsl) that loops loop thru the xml file and reuses the element names in the mapfile text output format... this way the xsl will be easy to maintain in future xsd versions.

I have to point out that I do not know all of Mapserver's mapfile elements so I just went thru the map and layer reference documentation to write the xsd. I usually work with only the basic mapfile tags needed to create wms and wfs services. 

(The xsd is attached to this email. Is there a special way to send an attached file to the dev group mailing list?)


-----Message d'origine-----
De : Steve Lime [mailto:Steve.Lime at dnr.state.mn.us] 
Envoyé : 19 juillet 2006 10:51
Objet : Re: [UMN_MAPSERVER-DEV] XML Mapfiles... are we looking to far?

I've thought for sometime that using XSL might be a nice bridge as we move in that direction. At least one could manage their configuration in XML than transform as necessary to create a mapfile for run-time use. There were some folks comtemplating developing a configuration schema file as a start a while back but they've disappeared as far as I know. 

I think that would be a nice first step if someone were to take it on: create mapfile XSD and XSL files. Ultimately we probably will have to be able to read a XML config file. I've toyed with using expat in developing a mapfile_xml.c. The underlying C structures would be the same, but a SAX parser would be used instead of Flex to tokenize the config file. Just never had time.


>>> "Julien, Heryk" <hjulien at NRCAN.GC.CA> 7/18/2006 8:45 AM >>>
Hi Tamas,

I think there are many advantages in using xml. First, XML files are easy to create and schema validation can check document structure while you are writing it. Schema aware editors can also give you hints and do automatic inputs of required tags while writing mapfile document. Yes Mapserver validates mapfiles, but I think the addition of a mapfile structure validator like xsd would facilitate mapfile creation and debugging.


Schemas can help newbie's to create there first config files and advanced users and developers visualise, communicate and work on the current mapfile format. I also think that it would be easier to extend the mapfile structure in future Mapserver versions if we where using an xml format... for example adding new OGC tags to mapfiles would be very easy.


Plus with all the new xml editing tools out there, schema creation, visualisation and validation has become a child's play (hmmm.... well almost!). 


Just as you said earlier, automating map config creation would be another great benefit. And if Mapserver could read non static mapfiles (via URL's), xml would be a great way to create dynamically generated mapfiles. If we consider mapfiles as being a kind of database (or database pointer), wouldn't it be great to be able to easily process it on the fly? XML coupled with xsl, xpath and databases would be one great way to do that kind of manipulation. A little like OGC WMC layers that are pointing to different data layers (wms layers), we could have dynamically generated mapfiles instead of one huge static file containing all data layers.


Xml being rapidly more and more widespread, ways for developers to input serialization data into Mapserver would be much greater and flexible. Mapfile management would be more open and greatly enhanced with the use of xml. For example a url fetched xml mapfile would enable us to easily modify a mapfile service according to certain parameter like language. We could thus have an automated multilingual mapfile. Currently we have to save a static mapfile for every language. They all point to the same data but containing language specific titles and metadata.


Being an OGC fan, I think there decision to use xml to disseminate data and ease interop has been a good choice. In that same line of thought, I think an xml mapfiles format to serialize Mapserver would be a logical next step.






Héryk Julien

Research Officer

Natural Resources Canada

490 rue de la Couronne

Québec, Canada


-------------- next part --------------
A non-text attachment was scrubbed...
Name: map.xsd
Type: application/octet-stream
Size: 9751 bytes
Desc: map.xsd
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20060719/fe0249ad/map.obj

More information about the mapserver-dev mailing list