Hello,<br><br>I am trying to query map in the datatbase(postgres)and display the map as requested by the user.For e.g.If user gives an area say "goa" to search then we have to display the map of "goa".<br>
I can retrieve "goa" from the database.But we are not getting how to generate the map of goa and display it dynamically.How to do this? Please help.<br>
<br><br><br>In our map file:<br><br>QUERYMAP<br> SIZE 200 150<br> STATUS ON<br> STYLE HILITE # SELECTED | NORMAL<br> COLOR 255 0 0<br> END<br><br><br>our php file contains the following code:<br>
<?php
<br> <br> dl('php_mapscript.so');
<br>dl('php_pgsql.so');
<br> // Default values and configuration
<br><br>$var1=$_POST["v1"]; <br><b style="color: rgb(153, 0, 0);">$src=$_POST["srch"];</b><br>$ss="";<br><br><br><br>$con= pg_connect("host=localhost password=mapserver user=postgres dbname=postgres port=5432");<br>
<br><br><br> if (!$con) {<br> echo("Connection Failed........");<br> <br> }<br>else<br>{<br> echo("con est");<br>}<br><br>if($var1=="on")<br>{<br>$ss="MS_ON";<br>}<br>else<br>
{<br>$ss="MS_OFF";<br>}<br><br><br><br>echo $ss;
<br> $val_zsize=3;
<br> $check_pan="CHECKED";
<br> $map_path="/opt/fgs/www/<div id=":55" class="ii gt">htdocs/";
<br> $map_file="global.map";
<br> <br> $map = ms_newMapObj($map_path.$map_file);<br> <br> <br>$layer = ms_newLayerObj($map);<br><br>$layerobj=$map->getLayerByName('INDIA_DIS');<br>$status = $layerobj->open(); <br><br><br><br>$projInObj = ms_newprojectionobj("proj=latlong");<br>
$projOutObj = ms_newprojectionobj("init=epsg:4326");<br><br>//$projOutObj = ms_newprojectionobj("init=epsg:4326");<br>$poPoint = ms_newpointobj();<br>$poPoint->setXY(-92.0, 62.0);<br>$poPoint->project($projInObj, $projOutObj);<br>
<br>$layerobj->set("status",MS_ON);<br><br><br><b style="color: rgb(204, 0, 0);">$result = pg_query($con, "select state from india_st where state='$src'");</b><br>if (!$result) {<br> echo "An error occured.\n";<br>
exit;<br>}
<br>
<br> <span style="color: rgb(204, 0, 0);"> </span><b style="color: rgb(204, 0, 0);"> $row = pg_fetch_row($result);<br> echo $row[0];<br></b><br><br><br>function setExtent($map)<br>{<br> $mapext = $_GET['mapext'];<br>
$mapext = explode(' ', $mapext);<br> <br> $extent['min']['x'] = floatval($mapext[0]);<br> $extent['min']['y'] = floatval($mapext[1]);<br> $extent['max']['x'] = floatval($mapext[2]);<br>
$extent['max']['y'] = floatval($mapext[3]);<br><br> $map->setExtent($extent['min']['x']<br> ,$extent['min']['y']<br> ,$extent['max']['x']<br>
,$extent['max']['y']<br> );<br>}<br> <br> if ( isset($HTTP_POST_VARS["mapa_x"]) && isset($HTTP_POST_VARS["mapa_y"])
<br> && !isset($HTTP_POST_VARS["full"]) ) {
<br> <br> $extent_to_set = explode(" ",$HTTP_POST_VARS["extent"]);
<br> <br> $map->setextent($extent_to_set[0],$extent_to_set[1],
<br> $extent_to_set[2],$extent_to_set[3]);
<br> <br> $my_point = ms_newpointObj();<br> <br> $my_point->setXY($HTTP_POST_VARS["mapa_x"],$HTTP_POST_VARS["mapa_y"]);<br> $my_extent = ms_newrectObj();
<br> $my_extent->setextent($extent_to_set[0],$extent_to_set[1],$extent_to_set[2],$extent_to_set[3]);<br><br> $zoom_factor = $HTTP_POST_VARS["zoom"]*$HTTP_POST_VARS["zsize"];<br> <br> if ($zoom_factor == 0) {
<br> $zoom_factor = 1;
<br> $check_pan = "CHECKED";
<br> $check_zout = "";
<br> $check_zin = "";
<br> } else if ($zoom_factor < 0) {
<br> $check_pan = "";
<br> $check_zout = "CHECKED";
<br> $check_zin = "";
<br> } else {
<br> $check_pan = "";
<br> $check_zout = "";
<br> $check_zin = "CHECKED";
<br> }
<br> <br> $val_zsize = abs($zoom_factor);
<br> <br> $map->zoompoint($zoom_factor,$my_point,$map->width,$map->height,
<br> $my_extent);<br> <br> <br><br><b style="color: rgb(204, 0, 0);">if($src)<br>{
<br>$image=$map->drawQuery();<br>}<br>else<br>{<br>$image=$map->draw();<br>}</b><br> <br>$image_url=$image->saveWebImage();
<br>$extent_to_html = $map->extent->minx." ".$map->extent->miny." "
<br> .$map->extent->maxx." ".$map->extent->maxy;<br><br><br>$layerobj->draw($image);<br><br> <br> ?>
<br> <HTML>
<br> <HEAD>
<br> <TITLE>Map 2</TITLE>
<br> </HEAD>
<br> <BODY>
<br> <CENTER>
<br> <FORM METHOD=POST ACTION=<?php echo $HTTP_SERVER_VARS['PHP_SELF']?>>
<br> <TABLE>
<br> <TR>
<br> <TD>
<br> <INPUT TYPE=IMAGE NAME="mapa" SRC="<?php echo $image_url?>"><br> <br> <br> </TD>
<br> </TR>
<br> <TR>
<br> <TD>
<br> Pan
<br> </TD>
<br> <TD>
<br> <INPUT TYPE=RADIO NAME="zoom" VALUE=0 <?php echo $check_pan?>>
<br> </TD>
<br> </TR>
<br> <TR>
<br> <TD>
<br> Zoom In
<br> </TD>
<br> <TD>
<br> <INPUT TYPE=RADIO NAME="zoom" VALUE=1 <?php echo $check_zin?>>
<br> </TD>
<br> </TR>
<br> <TR>
<br> <TD>
<br> Zoom Out
<br> </TD>
<br> <TD>
<br> <INPUT TYPE=RADIO NAME="zoom" VALUE=-1 <?php echo $check_zout?>>
<br> </TD>
<br> </TR>
<br> <TR>
<br> <TD>
<br> Zoom Size
<br> </TD>
<br> <TD>
<br> <INPUT TYPE=TEXT NAME="zsize" VALUE="<?php echo $val_zsize?>"
<br> SIZE=2>
<br> </TD><br><br><TD>
<br> <INPUT TYPE=radio NAME="query" SIZE=2 VALUE=1>
<br> </TD>
<br> </TR>
<br> <TR>
<br> <TD>
<br> Full Extent
<br> </TD><br> <TD><INPUT TYPE=CHECKBOX NAME="v1" VALUE="on" SIZE=2></TD>
<br> <TD>
<br> <INPUT TYPE=SUBMIT NAME="full" VALUE="Go"
<br> SIZE=2>
<br> </TD><br><br></TR><br><TR><br> <TD> LAYER INDIA</TD><br> <br></TR><br><tr><br><td><br>search<br></td><br><TD>
<br> <span style="color: rgb(204, 0, 0);"> </span><b style="color: rgb(204, 0, 0);"><INPUT TYPE=TEXT NAME="srch" SIZE=10>
</b><br> </TD><br><br> </tr> <br> </TABLE>
<br> <INPUT TYPE=HIDDEN NAME="extent" VALUE="<?php echo $extent_to_html?>">
<br> </FORM>
<br> </CENTER>
<br> </BODY>
<br> </HMTL>
<br></div>