[Mapserver-dev] Proposal for mapfile IO changes for MapServer 4.1

Daniel Morissette morissette at dmsolutions.ca
Wed Jul 2 12:50:33 EDT 2003

I don't know the parser well enough to tell how much work would be
involved, but I love the idea.  Your objective is probably to expose
those functions to MapScript in order to be able to serialize objects,

While we're at it, we should create an abstraction layer so that we can
have multiple implementations of the Load...String() and
Write...String() functions.  This way if someone wants to implement a
XML mapfile format (did I really write XML? ;) or use whatever database
mechanism to store map compositions then they could do it.

Maybe you should create a bug about this with the conclusions of this
thread once we agree on the direction to take.  Please make sure it is
marked version 4.1 if/when you create it.


Sean Gillies wrote:
> Hi,
> I'd like to proposal a change to the manner in which mapfiles
> are read and written for 4.1.  My proposed changes would enable
> us to write and load mapfile fragments.  Would love to hear
> what you think of this proposal.
> To start, I'd like to see msLoadMap() overhauled so that all
> the work is performed by a msLoadMapString() function.  Then
> we could reduce msLoadMap() to something like the following
> pseudocode:
> msLoadMap(filename)
> {
>      ...
>      fh = open(filename)
>      map_string = fh.read()
>      map = msLoadMapString(map_string)
>      ...
> }
> I'd also like to see this extended to layers, classes, etc.
> It would be really handy to take an existing map and then
> add a layer defined in a string like in this mapscript
> layer_string = 'NAME "foo"\nTYPE POLYGON\n' # for example
> layerobj = layerObj(mapobj, layer_string)
> An msLoadLayerString() function would be used in this new layerObj
> constructor.
> As well, I'd like to see *writeString() functions for map, layer,
> classes, and have msSaveMap() rewritten to call these.
> cheers,
> Sean

More information about the mapserver-dev mailing list