[Mapserver-users] Make a layer from a mysql query with x,y coordinates
Stéphane MOREL
stephane.morel at vanoise.com
Mon Jul 12 07:46:05 PDT 2004
I guess you can do that with mapserver/phpmapscript
You can use the following script developped by D Morissette
------------------------------------------------------------
Daniel Morissette danmo at videotron.ca
http://pages.infinit.net/danmo/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
<?
// Load MapScript
dl("php_mapscript.so");
//----------------------------------------------------------
// produce shapefile
//----------------------------------------------------------
function createPoint( $x, $y, $programId )
{
GLOBAL $shpFile, $dbfFile;
// Create shape
$oShp = ms_newShapeObj(MS_SHP_POINT);
$oLine = ms_newLineObj();
$oLine->addXY($x, $y);
$oShp->add( $oLine );
$shpFile->addShape($oShp);
// Write attribute record
dbase_add_record($dbfFile, array($programId));
}
$shpFname = "/tmp/shptest";
$shpFile = ms_newShapeFileObj( $shpFname, MS_SHP_POINT);
$dbfFile = dbase_create( $shpFname.".dbf", array(array("PROG_ID", "N", 5, 0)));
createPoint( 12, 34, 111);
createPoint( 22, 14, 222);
createPoint( 10, 20, 333);
echo "Shapes Created.<BR>";
//----------------------------------------------------------
// done... cleanup
//----------------------------------------------------------
$shpFile->free();
echo "Shape File ($shpFname) closed.<BR>";
echo "Dbase file closed.<BR>";
dbase_close($dbfFile);
?>
you can find the thread at :
http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0008/msg00134.html
regards
Stéphane MOREL
Parc national de la Vanoise
ludovic gnemmi a écrit :
>Hi,
>I'm looking for a way to make a point's layer from a
>Mysql query with x,y fields. I'm not using mygis.
>Is it possible with mapserver?
>Thanks a lot for your help.
>
>Ludovic
>
>
>
>
>
>
>Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
>Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
>
>Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
>_______________________________________________
>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