[mapguide-users] Problem with $resourceService (PHP)

Galois amihalas at yahoo.gr
Wed Oct 29 18:10:42 EDT 2008


I cannot find this file somewhere in my computer, can u plZ send a link?

Thank u...


Chris Claydon wrote:
> 
> The "Theme" sample in the php viewer samples creates a new themed layer
> and adds it to the map.
> 
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Galois
> Sent: Wednesday, October 29, 2008 9:32 AM
> To: mapguide-users at lists.osgeo.org
> Subject: RE: [mapguide-users] Problem with $resourceService (PHP)
> 
> 
> For the first problem, you were wright!!!
> 
> I'm using version 1.2.0...
> 
> Now let's suppose that I want to add a new layer to the runtime map, have
> u
> any sample code about it?
> 
> Thank u a lot!
> 
> 
> 
> Chris Claydon wrote:
>>
>> You can enable display of PHP errors by modifying the php.ini file in the
>> WebServerExtensions/Php folder. Change the setting of "display_errors" to
>> On. This should help to determine the source of any script errors. You'll
>> probably need to re-start the web tier for this to take effect.
>>
>> Regarding Problem 1:
>>
>> This script is intended to be launched from a web layout, which will
>> already have instantiated a session-based map resource. In your case, it
>> is getting run before you load the web layout, so if you want it to
>> succeed, you need to use $map->Create instead of $map->Open. (Note that
>> the variable $mgMapName that you are using is not currently defined in
>> your script).
>>
>> Something like this should work (though it doesn't actually do anything
>> with the SRS once it has it):
>>
>>         // Get the user information using the session id,
>>         // and set up a connection to the site server.
>>         $userInfo = new MgUserInformation($sessionId);
>>         $siteConnection = new MgSiteConnection();
>>         $siteConnection->Open($userInfo);
>>           $mapResourceId = new
>> MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
>>           $mgMapName = "MySheboyganMap";
>>
>>         // Get an instance of the required service(s).
>>         $resourceService =
>> $siteConnection->CreateService(MgServiceType::ResourceService);
>>
>>
>>         // Display the spatial reference system used for the map.
>>         $map = new MgMap();
>>         $map->Create($resourceService, $mapResourceId, $mgMapName);
>>         $srs = $map->GetMapSRS();
>>
>> Regarding Problem 2:
>>
>> I think there was a bug at one time where the session ID didn't get
>> passed
>> in to the script being invoked. That could be what's causing your
>> problem.
>> What version of the product are you using?
>>
>> Chris.
>>
>> -----Original Message-----
>> From: mapguide-users-bounces at lists.osgeo.org
>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Galois
>> Sent: Wednesday, October 29, 2008 7:33 AM
>> To: mapguide-users at lists.osgeo.org
>> Subject: [mapguide-users] Problem with $resourceService (PHP)
>>
>>
>> Hello,
>>
>> I have two problems so If anyone knows something I would appreciate
>> his/her
>> help.
>>
>> Problem 1
>> when I define a resourceService, my page doesn't show.
>>
>> The code is copy - paste from Dev's Guide:
>>
>> <?php
>>         $installDir = 'C:\Program Files\MapGuideOpenSource\\';
>>         $extensionsDir = $installDir . 'WebServerExtensions\www\\';
>>         $viewerDir = $extensionsDir . 'mapviewerphp\\';
>>         include $viewerDir . 'constants.php';
>>
>>         MgInitializeWebTier($extensionsDir . 'webconfig.ini');
>>
>>         $site = new MgSite();
>>         $site->Open(new MgUserInformation("Administrator", "admin"));
>>         $sessionId = $site->CreateSession();
>>
>>         $webLayout
>> ="Library://GoSpatial/WebLayout/Autostrada+Brescia+Padova+Map.WebLayout";
>>
>>         // Get the user information using the session id,
>>         // and set up a connection to the site server.
>>         $userInfo = new MgUserInformation($sessionId);
>>         $siteConnection = new MgSiteConnection();
>>         $siteConnection->Open($userInfo);
>>
>>         // Get an instance of the required service(s).
>>         $resourceService =
>> $siteConnection->CreateService(MgServiceType::ResourceService);
>>
>>
>>         // Display the spatial reference system used for the map.
>>         $map = new MgMap();
>>         $map->Open($resourceService, $mgMapName);
>>         $srs = $map->GetMapSRS();
>>
>> ?>
>> <html>
>> <head>
>> <title>Simple Sample Application</title>
>> </head>
>> <body marginheight="0" marginwidth="0">
>> <iframe id="viewerFrame" width="100%" height="100%" frameborder=0
>> scrolling="no"
>> src="http://127.0.0.1:8008/mapguide/mapviewerajax/?SESSION=<?=$sessionId?>&WEBLAYOUT=<?=
>> $webLayout ?>&username=Administrator&password=admin"></iframe>
>> </body>
>> </html>
>>
>> If I comment the lines from where I define $resourceService till the end
>> of
>> php script, my map is loading...
>>
>> Problem 2
>> When I try to run the phpSamples (for example the Hello Map) and I press
>> on
>> the "Display Spatial Reference  ", I get the following error:
>>
>> "Error: Invalid argument(s): [1] = "" The session ID is invalid because
>> the
>> session separator character was not found. Exception occurred in method
>> MgUserInformation.SetMgSessionId at line 165 in file
>> c:\build_bond_area\mapguide_open_source_v1.2\build_18.1\mgdev\common\mapguidecommon\System/UserInformation.cpp"
>>
>> Generally, I cannot run any of the samples...
>>
>> Thanks in Advance!
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-with-%24resourceService-%28PHP%29-tp20227195p20227195.html
>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>>
> 
> --
> View this message in context:
> http://www.nabble.com/Problem-with-%24resourceService-%28PHP%29-tp20227195p20229630.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-%24resourceService-%28PHP%29-tp20227195p20236918.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list