dynamic point generation with php-mapscript
Gavin Simpson
gavin.simpson at UCL.AC.UK
Fri Apr 15 04:06:19 PDT 2005
Wouter Schaubroeck wrote:
> Hi,
>
> I was wondering if anyone would know some good examples of generating
> dynamic points with php mapscript? For example: just pulling the points
> from (in my case: a MySQL db) a database and displaying them without a
> shape file? And is it possible to do queries on that layer, or
> displaying the attribute data? I assume not, because there's no
> associated dbf file.
>
> Best regards,
>
> Wouter Schaubroeck
>
>
See the PHP/Mapscript WIKI - which has such an example:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptAddPoint
Querying that layer is more problematic. You need to create a shapeObj
and addFeature()'s to that shapeObj etc:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples42ex1
shows you how to do this with Perl which is easily translated to PHP (I
did it yesterday but my code is in a mess of other trial stuff just
now), with one major exception! PHP/Mapscript is broken at the moment
and you can't set the index of a shapeObj added to a layer (it needs to
be numeric, integer, incrementing in steps of 1 - so not a arbitrary
ordering of ID's from a mysql table index, currently it returns -1
error), which you need to have queryByPoint do anything useful etc. See:
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=806
A patch has been accepted for this bug so you can download a nightly or
the cvs of mapserver (or replace php_mapscript.c in the tarball of
mapserver4.4.2 with the one in that bug report) and roll your own
php_mapscript.so.
After a few errors I have just gotten this compiling as well (a
nightly), so maybe I can query that layer after all... :-)
Please note - I'm a mapserver virgin so I've been bumbling through this
for only a day or so - feel free to email me further about this but I
can't guarantee I'll be able to help much beyond providing some very
early php code.
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk
UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/
London. WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the MapServer-users
mailing list