PHPMapScript and OGR
Murat BEYHAN
beyhan at DEPREM.GOV.TR
Fri Sep 22 04:21:23 PDT 2006
Dear Friends;
I'm trying to draw a point on the map by using ogr connection.
I have already achieved it by using mapserver and OGR.
But Now I'm reading latitude and longitude of the poimt from mysql by using php.
By following
$iladi=$_POST['iller'];
$ilceadi=$_POST['ilceler'];
$koyadi=$_POST['koyler'];
$query = "SELECT * FROM $db_tb WHERE city LIKE '$iladi' AND
district LIKE '$ilceadi' AND village LIKE '$koyadi'";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
$num = mysql_numrows($result);
$i=0;
while ($i < $num) {
$koyadi = mysql_result($result,$i,"village");
$ilceadi = mysql_result($result,$i,"district");
$iladi = mysql_result($result,$i,"city");
$zone = mysql_result($result,$i,"zone");
$lon = mysql_result($result,$i,"lon");
$lat = mysql_result($result,$i,"lat");
++$i;
}
and I draw map by followings
$map_path="/var/www/html/zone/";
$map = ms_newMapObj($map_path."zone.map");
$map->setExtent($nMinX, $nMinY, $nMaxX, $nMaxY);
$ref = $map->drawreferencemap();
$legend=$map->drawLegend();
$image=$map->draw();
thats ok. But I would like to draw just one point on the map by using result
value of mysql query in php. I'm not sure there is some easy way may be exist
in PHPmapscript . May be by using querymap or etc. But I have try it by using ogr
LAYER
NAME sel_loc
CONNECTIONTYPE OGR
CONNECTION '<OGRVRTDataSource>
<OGRVRTLayer name="sel_loc">
<SrcDataSource>MYSQL:bina,user=root,password=mysql_123,host=localhost,port=3306,tables=zoneson</SrcDataSource>
<SrcSQL>SELECT lat,lon,village from zoneson where village = "%koyadi%" and
city = "%iladi%" and district = "%ilceadi%" </SrcSQL>
<GeometryType>wkbPoint</GeometryType>
<GeometryField encoding="PointFromColumns" x="lon" y="lat"/>
</OGRVRTLayer>
</OGRVRTDataSource>'
DATA sel_loc
STATUS default
TYPE POINT
CLASS
NAME "koy merkezis"
SYMBOL "cpoint"
SIZE 15
COLOR 255 255 0
END
END
but the
By using above codes I have sent data from html code.But I could'n do with
PHPmapScript please help me
what I'm doing wrong...
Or are there any easy way with phpMapScript for do that. Thank you very much.
Murat
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the MapServer-users
mailing list