[Mapserver-users] Displaying x-y Datasets using PHP/Mapscript

Frieso ter Haseborg ter-haseborg at sf-datentechnik.de
Thu Feb 12 08:42:20 PST 2004


Hi,

> Is it possible...
Yes! Works great.

> but I have no idea how to do create layers or maps using 
> PHP/Mapscript.

Take a look at http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScript
and http://mapserver.gis.umn.edu/doc/phpmapscript-class-guide.html.

There should be a lot of examples around.

Just a snipped to get the basic idea:
[...]
$layer =  $map->getLayerByName( "p" );       //get a point-layer defined
in the map-file
$layer->set('status', MS_ON);                //activate this layer

$pt = ms_newPointObj();                     //create a point-object
$pt->setXY( $x1, $y1 );                     //set coordinates
$pt->draw($map, $layer, $image, 0, "Pt1");  //draw the point

$pt = ms_newPointObj();                     //...and so on...
$pt->setXY( $x2, $y2 );
$pt->draw($map, $layer, $image, 0, "Pt2");

$map->drawLabelCache($image);
$image_url=$image->saveImage(""); 
[...]

Create a loop for the point-draw mentioned above fed with the $x, $y
coordinates from any RDBMS php can handle.

HTH,
 
Frieso ter Haseborg
- Software Development - 
 
--

-------------------------------------------------- 
S&F Datentechnik GmbH&Co.KG 
Reimersstr. 41b 
26789 Leer, Germany



> -----Original Message-----
> From: Jan Vietmeier [mailto:jan at vietmeier.de]
> Sent: Wednesday, February 11, 2004 3:14 PM
> To: mapserver users
> Subject: [Mapserver-users] Displaying x-y Datasets using PHP/Mapscript
> 
> 
> Hi All,
> I use Mapserver 4.0 with PHP/Mapscript on Windows NT.
> 
> Is it possible to create a new layer from a dataset (e.g. list of
> x-y-coordinates) using PHP/Mapscipt? My intention is to read some
> coordinates from an odbc-connection using php and display the 
> coordinates
> with PHP/Mapscript.
> 
> The
> http://mapserver.gis.umn.edu/doc40/phpmapscript-byexample-howt
> o.html -Howto
> says that PHP/Mapscript "... includes the possibility of 
> dynamically create
> maps or modify existing ones and to (and here is the key to 
> the flexibility
> that MapScript has) mix this information with other sources 
> of non GIS data,
> such as user input, non spatial and spatial databases, text 
> files, etc. and
> that you can use ..." and also promises the possibility of 
> "... creation of
> dynamic layers and classes ..."
> 
> but I have no idea how to do create layers or maps using 
> PHP/Mapscript.
> 
> Any comments or suggestions would be helpful.
> 
> Jan
> 
> Jan Vietmeier, Diplom-Geograph
> Im Fichtenhain 18
> 51069 Köln
> 
> Tel.  +49 (0)221 9468252
> Mobil +49 (0)178 3744854
> Fax.  +49 (0)221 9468251
> 
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 
> 




More information about the MapServer-users mailing list