[Mapserver-dev] Fwd: [Bug 357] New: RFE: refactor mapserver to load/save map file fragments from/to strings

Sean Gillies sgillies at frii.com
Wed Jul 9 14:26:03 EDT 2003

Hi all,

If you are interested in this enhancement, add yourselves to
issue 357's cc: list.


Begin forwarded message:

> From: bugzilla-daemon at lists.gis.umn.edu
> Date: Wed Jul 9, 2003  12:08:21  PM America/Denver
> To: sgillies at frii.com
> Subject: [Bug 357] New: RFE: refactor mapserver to load/save map file 
> fragments from/to strings
> http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=357
>            Summary: RFE: refactor mapserver to load/save map file 
> fragments
>                     from/to strings
>            Product: MapServer
>            Version: 4.1
>           Platform: All
>         OS/Version: All
>             Status: NEW
>           Severity: enhancement
>           Priority: P2
>          Component: MapServer C Library
>         AssignedTo: steve.lime at dnr.state.mn.us
>         ReportedBy: sgillies at frii.com
> I'd like to propose a change to the manner in which mapfiles
> are read and written for 4.1.  My proposed changes would enable
> us to write and save map file fragments.  These enhancements
> are primarily aimed at improving MapServer's ability to
> serialize/marshal mapping objects.
> To start, I'd like to see msLoadMap() refactored so that all
> the work is performed by a msLoadMapString() function.  Then
> we could reduce msLoadMap() to something like the following
> pseudocode:
> def msLoadMap(filename)
>     fh = open(filename, 'r')
>     map_string = fh.read()
>     return msLoadMapString(map_string)
> I'd also like to see this extended to layers, classes, etc.
> msLoadMapString would call msLoadLayerString,
> msLoadClassString, etc where necessary.  These functions also
> 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.
> Steve Lime points out that these enhancement would also be useful
> for the CGI mapserv:
>    In addition, this could be considered as a general
>    replacement for the map_ syntax already supported by the CGI
>    application. It works well if you only need to make a change or
>    two but is to clunky for much broader use. Moving to a single
>    parser that would work for a complete mapfile or just a piece
>    would really simplify maintenence.
> Daniel Morissette adds:
>    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.
> This is a good idea, but I wouldn't want the issues of an XML map file
> to distract from this particular feature enhancement.
> While we are refactoring, perhaps we could move code into mapobject.c,
> layerobject.c, etc and delete mapfile.c?
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
Sean Gillies
sgillies at frii dot com

More information about the mapserver-dev mailing list