[mapguide-users] How can i seperate the tileServices?

George McLean gmclean at gorge.net
Mon May 26 10:37:55 EDT 2008


I wrote a php script to accomplish this. I am using MGOS 1.2 on a
windows machine and found I had to restart the Mapguide service
periodically or I would get blank tiles. There would be no error message
but the tiles would not have any image. To get around this problem I ran
my php script in a batch file which would restart the Mapguide service
after a set number of tiles. It's not elegant but it seemed to work.

The php script below has some hard coded paths that would need to be
changed.

<?

$startCol = $argv[1];
$endCol = $argv[2];
$startRow = $argv[3];
$endRow = $argv[4];
$zLevel = $argv[5];

require_once 'common_locations.php';
include 'c:\program
files\MapGuideOpenSource\WebServerExtensions\www\mapviewerphp\constants.php';

try
{
$mgMapName = "umsfdo";

MgInitializeWebTier("$extensionsDir\webconfig.ini");
// Get the user information using the session id,
// and set up a connection to the site server.
$userInfo = new MgUserInformation("Administrator", "admin");
$site = new MgSite();
$site->Open($userInfo);
$mgSessionId = $site->CreateSession();
$userInfo = new MgUserInformation($mgSessionId);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);

// Get an instance of the required service(s).
$resourceService = $siteConnection->
CreateService(MgServiceType::ResourceService);
$featureService = $siteConnection->
CreateService(MgServiceType::FeatureService);
// Display the spatial reference system used for the map
$map = new MgMap();
$resourceID = new
MgResourceIdentifier('Library://MapWithStates/Map/GoogleElipse.MapDefinition');
$map->Create($resourceService, $resourceID, $mgMapName);

$mgTileServer = $siteConnection->CreateService(MgServiceType::TileService);

$tileSize = $mgTileServer->GetDefaultTileSizeX();

// Mapguide farthest out zoom level is S11 in the tileCache folders
// Googles farthest out zoom level is 0
// The array below allows us to start at the highest zoom level

$scales = array (11,10,9,8,7,6,5,4,3,2,1,0);

for ($index = $zLevel-1; $index < $zLevel; $index++)
{
for ($col =$startCol ; $col < $endCol; $col++)
{
for ($row = $startRow; $row < $endRow; $row++)
{
$mgTileServer->GetTile($resourceID, 'Base Layer Group', $col, $row,
$scales[$index]);
$message = 'Tile Built: '.$row.'_'.$col.' ';
echo $message;
}
}
}

}
catch (MgException $e)
{
echo "Error!";
echo $e->GetMessage();
echo $e->GetDetails();
}


?>

This is the batch file:

net stop "Mapguide Server v1.2"
net start "Mapguide Server v1.2"
PING 1.1.1.1 -n 1 -w 10000 >NUL
php MakeTiles.php 140 150 330 450 10

net stop "Mapguide Server v1.2"
net start "Mapguide Server v1.2"
PING 1.1.1.1 -n 1 -w 10000 >NUL
php MakeTiles.php 150 160 330 450 10

net stop "Mapguide Server v1.2"
net start "Mapguide Server v1.2"
PING 1.1.1.1 -n 1 -w 10000 >NUL
php MakeTiles.php 160 170 330 450 10

etc....

Hope this helps

George McLean


xuzhengeology wrote:
> i use mapguide server 1.2 to develop GIS apllication.
> we use tiff(400Mb) as back layer.we classify the tiff to 8
> class,so,after tiled ,it goes to about 900Mb.
> we have to move the image from the website to make the server cache
> the image.it costs a lot of time.
> we have to go through the whole image before we publish it because the
> tile services cause the server crash very quickly.we must restart the
> mgserver very often.
> can anyone tell me how to seperate the tile services?so ,i can use
> programme to tile the whole image and then just copy the tiles to the
> server folder?
> Thanks.
> 2008-05-26
> ------------------------------------------------------------------------
> xuzhengeology
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG. 
> Version: 8.0.100 / Virus Database: 269.24.1/1466 - Release Date: 5/25/2008 6:49 PM
>   



More information about the mapguide-users mailing list