Building dynamic maps using Perl or PHP

Daniel Morissette morissette at
Tue Nov 14 15:38:34 EST 2000

Stephan Dunning wrote:
> My thinking is that I should be able to connect to my database using either
> Perl or PHP, then pull in my data and join it to the chosen shapefile .dbf,
> build my mapfile, and display the map for the user.  Does this sound
> reasonable?  
> Which is the better laguage to use: Perl or PHP (or another)?
> Are there any recommended resources available in addition to the Perl and
> PHP sites linked through MapServer's site?  Does anyone have a good example
> of a similar application?


That approach has been used by us and by a couple of MapScript users and
works very well.  Note that you won't be able to 'join' your created DBF
table to an existing shapefile... you'll have to copy the .shp/.shx and
create a new dbf for it with a temporary (unique) filename (you could
use a logical link for the .shp/.shx on Unix).

Unfortunately I'm not aware of any sample application available in
source code that does that.  However, there is a sample script
distributed with the MapServer source that shows how to create
shapefiles: mapserver/mapscript/php3/examples/test_writeshape.phtml

In our case we used PHP (obviously!).  Since you're on NT I'm not sure
if Perl is an option for you.  I don't think we've had a report of
succesfull use of Perl MapScript on NT yet?

 Daniel Morissette                morissette at
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.

More information about the mapserver-users mailing list