14.01.2013 Views

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$mapDefId = new MgResourceIdentifier(<br />

"Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");<br />

$map = new MgMap();<br />

$mapName = $mapDefId->GetName();<br />

$map->Create($resourceService, $mapDefId, $mapName);<br />

$mapId = new MgResourceIdentifier(<br />

"Session:$sessionId//$mapName." . MgResourceType::Map);<br />

$map->Save($resourceService, $mapId);<br />

Understanding Services<br />

The Map<strong>Guide</strong> site performs many different functions. These can be all done<br />

by a single server, or you may balance the load across multiple servers. Some<br />

essential functions must execute on the site server, while other functions may<br />

execute on support servers.<br />

A service performs a particular set of related functions. For example, a resource<br />

service manages data in the repository, a feature service provides access to<br />

feature data sources, and a mapping service provides visualization and plotting<br />

functions.<br />

Before a page can use a service, it must open a site connection and create an<br />

instance of the necessary service type. The following example creates a resource<br />

service and a feature service:<br />

$userInfo = new MgUserInformation($mgSessionId);<br />

$siteConnection = new MgSiteConnection();<br />

$siteConnection-><strong>Open</strong>($userInfo);<br />

$resourceService = $siteConnection-><br />

CreateService(MgServiceType::ResourceService);<br />

$featureService = $siteConnection-><br />

CreateService(MgServiceType::FeatureService);<br />

Understanding Services | 21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!