[ka-Map-users] Creating Maps on Fly
Paul Spencer
pspencer at dmsolutions.ca
Tue Sep 19 21:24:55 EDT 2006
Hi Ghulam,
not sure if anyone responded ... we were all pretty busy with FOSS4G :)
To get this to work will require some changes to the PHP files that
come with ka-Map. Essentially, ka-Map uses three PHP files:
config.php - not used directly, but contains all the configuration
information
init.php - uses config.php, returns javascript to kaMap that tells it
about the map files and layers so that the user interface can be set up
tile.php - uses config.php and dynamically returns tile images from
the cache, or creates the tiles if they are not in the cache
You will need to modify init.php and tile.php to achieve your goals.
Hopefully you would need only small changes though.
Cheers
Paul
On 14-Sep-06, at 4:05 AM, Ghulam Muqtada wrote:
> 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.
>
> <?php
> include_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! Talk
> now!
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Chief Technology Officer |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+
More information about the ka-Map-users
mailing list