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.
<br><br><br>function consultar($query) {<br><br> <br> @mysql_connect("localhost", "gis", "*****")<br> or die("Could not connect to MySQL server!");<br> <br> @mysql_select_db("db")
<br> or die("Could not select database");<br> <br> $result = mysql_query($query);<br> <br> <br> $i = 0;<br> while ( $row = mysql_fetch_array($result) )<br> {<br> $qresult[$i] = $row;
<br> $i++;<br> }<br> <br> return $qresult;<br><br>}<br><br>function llegirTrampes ($finca, $parcela ) {<br><br> global $mapa;<br> $this_layer = $mapa->getLayerByName('Trampes');<br> // Canviar x $finca i $parcela
<br> $qresult = consultar("SELECT nom, round(utmx,2) as utmx, round(utmy,2) as utmy FROM trampa t where idfinca=$idfinca and idparcela=$idparcela");<br> $shape = ms_newShapeObj(MS_SHAPE_POINT); <br> foreach($qresult as $row) {
<br> $punt = ms_newPointObj();<br> $linia = ms_newLineObj();<br> $punt->setXY($row[1],$row[2]);<br> $linia->add($punt);<br> $shape->add($linia);<br> }<br> $this_layer->addFeature( $shape );
<br> return;<br>}<br><br><br>I'd like to change the symbol of the point depending the feature... Some ideas?<br>Thanks alot, I'm a little lost<br>(sorry for my english)<br><br>