[ka-Map-users] Creating Maps on Fly

Ghulam Muqtada muqtada at hotmail.com
Thu Sep 14 04:05:03 EDT 2006


Hi All,
 
I am new to ka-maps and facing some problems can any body help me creating maps on fly, may I ignore the maps files and use my own mapscript instead, my mapscript code works fine and also draw maps, how can I handle my own mapscript to config.php or to init.php, ,my code is as follow.
 
<?phpinclude_once('admin/super/classes/Connection.php');
if (!extension_loaded("MapScript")) dl('php_mapscript_48.'.PHP_SHLIB_SUFFIX);  
class MapHandler{
 function getMyMaps($user_id) {$con= new Connection();$con->connect();$con->selectDatabase("blot");$myCon=$con->getConnectionReference();$count=0;$userMap=array();$userMaps=array();
$qry="SELECT * from maps where user_id=".$user_id;$rs=mysql_query($qry ,$myCon) or die(mysql_error());
  if(mysql_num_rows($rs) > 0 )  {  while($row=mysql_fetch_array($rs))  { $lot_id=$row['lot_id']; $lot_name=$row['lot_name']; $lot_width=$row['image_width']; $lot_height=$row['image_length']; $lot_image="admin".$row['image_location']; $myMap= ms_newMapObj("mapTest.map");
 $myMap->set("name","lot".++$count); $myMap->set("width",$lot_width); $myMap->set("height",$lot_height); $myMap->setExtent(0.0,0.0,$lot_width,$lot_height); $myMap->selectOutputFormat("png"); $myMap->outputformat->set("transparent", MS_ON ); $myLayer = ms_newLayerObj($myMap); $myLayer->set( "name", "Lot"); $myLayer->set( "type", MS_LAYER_RASTER); $myLayer->set( "status", MS_ON); $myLayer->set( "data",$lot_image); $myMap->web->set("imagepath","/ms4w/tmp/ms_tmp/kacache/"); $myMap->web->set("imageurl","/ms_tmp/kacache/"); $myMap->reference->set("width",($lot_width/4)); $myMap->reference->set("height",($lot_height/4)); $myMap->reference->set("image",$lot_image); $myMap->reference->set("status",MS_ON);  //$myMap->reference->setextent(0, 0, 100,150); $rect= ms_newRectObj(); $rect->setextent(0.0, 0.0, ($lot_width/4), ($lot_height/4)); $userMaps['plot'.$count++] = $myMap;}  $szMap = 'plot0';  //$aszMapFiles=$userMaps;  return $userMaps;  }  }}?>
 
can I handover $userMaps to ka-map to deal with these maps only , what i have to do, 
 
Regards
Ghulam Muqtada
_________________________________________________________________
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20060914/da6dc704/attachment.html


More information about the ka-Map-users mailing list