Doubts about points in php mapscript
John Prof
jonnyprof at GMAIL.COM
Tue Sep 26 03:40:09 PDT 2006
Hello, I'm trying to create a map using Mysql data. I've obtained one with
the points on the map, but I would like to have the name of each point. I'd
made the map adding a shape with the points in a layer, but I don't know how
to put a name in each point (column 'nom' of the query), there is no "name"
field or similar in the PointObj object.
function consultar($query) {
@mysql_connect("localhost", "gis", "*****")
or die("Could not connect to MySQL server!");
@mysql_select_db("db")
or die("Could not select database");
$result = mysql_query($query);
$i = 0;
while ( $row = mysql_fetch_array($result) )
{
$qresult[$i] = $row;
$i++;
}
return $qresult;
}
function llegirTrampes ($finca, $parcela ) {
global $mapa;
$this_layer = $mapa->getLayerByName('Trampes');
// Canviar x $finca i $parcela
$qresult = consultar("SELECT nom, round(utmx,2) as utmx, round(utmy,2)
as utmy FROM trampa t where idfinca=$idfinca and idparcela=$idparcela");
$shape = ms_newShapeObj(MS_SHAPE_POINT);
foreach($qresult as $row) {
$punt = ms_newPointObj();
$linia = ms_newLineObj();
$punt->setXY($row[1],$row[2]);
$linia->add($punt);
$shape->add($linia);
}
$this_layer->addFeature( $shape );
return;
}
I'd like to change the symbol of the point depending the feature... Some
ideas?
Thanks alot, I'm a little lost
(sorry for my english)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060926/86d455e3/attachment.htm>
More information about the MapServer-users
mailing list