[RE]:How to avoide HUGE .map files
Gail Long
codeburg at HOTMAIL.COM
Sat Mar 11 11:25:09 PST 2006
As an alternative to cpp,
The m4 macro processing tools are really good for setting up and configuring
larger files with lots of elements. Sendmail and several other packages
that have very large and complex text structures use m4 to build their
configuration files.
I've used it to define complex DNS management tools for some large SOA
servers, and in the past its been helpful for creating large configuration
files like exim and sendmail.
Using m4 you create your base template with its macros then you can
manipulate your more dynamic sections anyway you like. One of the more
powerful aspects of m4 is that it is very very fast and you can edit or
create your included files on the fly then call it from perl or php from
your CGI program. It would build the files you need based on operating
context like current date, timezone, or look and feel for a particular type
of user.
Additionally m4 can be used for your html files as well. You put the common
pieces in macros, edit the pieces of the the file that need to be regularly
changed and then generate you pages.
Its a little daunting to get a handle on at first but once you understand
the basics its one of those things you wonder how you lived without.
An easier to understand alternative would be to use perl Text::Template.
Its a little more work to put together, but its very flexible and will build
your files very quickly. You can also use this method as a quick way to
switch the order of layers and classes. If you were really ambitious you
could put a web or perl/tk interface over it.
A third alternative is php and the Smarty template engine (smarty.php.net).
You create your templates using any design syntax you want, then run
commandline PHP to build the files. I only suggest this one because some
folks like to stick with one language. This is a very powerful alternative
and can be used for many chores.
I'm not forgetting that python, tcl, expect, and ruby have very powerful
template engines that I assume would work very well, however, I've not used
any of them for that.
One of the plusses is that you have all of these available on linux and if
you are a windows user you can get windows versions, or you can go get a
cygwin (www.cygwin.com) install and have them all available.
--
Things are only difficult while you don't understand them.
>From: Siki Zoltan <siki at AGT.BME.HU>
>Reply-To: Siki Zoltan <siki at AGT.BME.HU>
>To: MAPSERVER-USERS at LISTS.UMN.EDU
>Subject: Re: [UMN_MAPSERVER-USERS] How to avoide HUGE .map files {Scanned}
>Date: Thu, 9 Mar 2006 22:20:06 -0100
>
>Hi,
>
>You can use cpp (c preprocessor) havind #include directives.
>The only withdraw you have to escape map file comments using ## or \#
>
>Zoltan
>
>On Thu, 9 Mar 2006, Michael Scharber wrote:
>
> > Ed,
> >
> > Though I'm not looking for an editor, per se, I would like to know how
>to
> > reuse chunks of mapfile config (100s of lines) across multiple mapfiles
> > with little or no replication. Is there a way to "include" mapfile
> > fragments into other mapfiles?
> >
> > Michael
> >
> >
> > On Thu, 9 Mar 2006, Ed Dowding wrote:
> >
> > > Does anyone have any advice on how to avoid huge .map files?
> > >
> > > We have a flash interface to our mapserver app, and we have mapping
>for the
> > > whole or europe (and much of america) down to building outline level.
> > >
> > > Our interface makes it possible to scroll the map from country to
>country,
> > > and zoom in/out, so really all styling has to be in the one file.
> > >
> > > But...
> > >
> > > 1) Does it all have to be in that file? Am I right about this?
> > >
> > > 2) any tips on managing and styling them? I'm currently using jedit
>since it
> > > has nice code folding. I'm yet to find a GUI that exports .map files
>in a
> > > format that is immediately usable.
> > >
> > > 3) any other tips from anyone?
> > >
> > > Thanks in advance,
> > >
> > > Ed
> > >
> >
More information about the MapServer-users
mailing list