I just read from this question that the OP was
using Mapscript and C# to generate and display a Mapfile
I was wondering if it is really possible to use MapScript to generate a Mapfile? And if so, is there an example of doing so with PHP MapScript?
P.S. I am new to MapServer, and I feel that manually writing every mapfile's is a pain even if I learn all its grammar. It would be nice if a bunch of mapfiles can be generated from a program by varying certain parameters.
If MapScript isn't the solution, is there any other way to generate mapfiles programmatically?
P.S.2. This post asks a similar question about doing it in python, but there seems to be no solution in the answers.
Thanks in advance,
— EDIT —
Just to clarify, I am interested in writing/serialization of Mapscript objects into a mapfile (in PHP), not writing a mapfile verbatim via a programming languages such as PHP or C++. From the SO question quoted, this seems possible in C#. I was asking whether there are specific examples of actually doing that (preferably in PHP).
Best Answer
Ok, this is not really a GIS related but rather a programming related question. Anyway, for your intended purpose you can use almost any language you like. Here is a very, very simple PHP script based on the example Mapfile from the documentation at http://www.mapserver.org/mapscript/php/by_example.html. In this script only the variable
DATA
is altered:Run the script with
php script.php
.