Thx again.
I managet to get it working with USERNAME and PASSWORD...
---------------------------------------------------------
   <img src="/mapguide/mapagent/mapagent.fcgi?
    OPERATION=GETMAPIMAGE&
    VERSION=1.0.0&
    USERNAME=Anonymous&
    PASSWORD=&
    LOCALE=en&
    CLIENTAGENT=MapGuide+Developer&
    MAPDEFINITION=Library%3A%2F%2FDemo%2FMaps%2Demo.MapDefinition&
    FORMAT=PNG&
    ... etc. parameters...
    " />
---------------------------------------------------------

But still, would like to use SESSION if possible.
I initialize MGOS WebTier...
Create one frame with IMG tag with getMapImage...
And one with complete weblayout.
I suppose I dont initialize the resource needed for the mapAgent to work, am I right?
This is my PHP test page...
---------------------------------------------------------
<?php
require_once('common.php');
try
{
   // Initialize the web extensions,
   MgInitializeWebTier ($webconfigFilePath);
   // Connect to the site server and create a session
   $userInfo = new MgUserInformation("Anonymous", "");
   $site = new MgSite();
   $site->Open($userInfo);
}
catch (MgException $e)
{
echo "Could not connect to the MapGuide site server. Please contact the MapGuide site administrator.";
   die();
}
try
{
   $sessionId = $site->CreateSession();
   $siteConnection = new MgSiteConnection();
   $siteConnection->Open(new MgUserInformation($sessionId));
 $resourceService =
 $siteConnection->CreateService(MgServiceType::ResourceService);
$mdResourceId = new MgResourceIdentifier("Library://Demo/Maps/Demo.MapDefinition");
   $mapName = $mdResourceId->GetName();
   // Define some constants
   $webLayout   = "Library://Demo/Layouts/Demo.WebLayout";
   $title         = "Demo";
}
catch (MgException $e)
{
   echo "ERROR: " . $e->GetMessage("eng") . "\n";
   echo $e->GetStackTrace("eng") . "\n";
}
?>
<html>
<frameset rows="60%,40%">
<frame width="100%" height="96%" frameborder="0" name="main_weblayout"
    src="/mapguide/mapviewerajax/?
    SESSION=<?= $sessionId ?>&
    MAPNAME=<?= $mapName ?>&
    WEBLAYOUT=<?= $webLayout ?>"
/>
<frame width="100%" height="96%" frameborder="0" name="main_weblayout2"
  src="/mapguide/mapagent/mapagent.fcgi?
    OPERATION=GETMAPIMAGE&
    VERSION=1.0.0&
    SESSION=<?= $sessionId ?>&
    MAPNAME=<?= $mapName ?>&
    FORMAT=PNG&
    ... etc. parameters...
/>
</frameset>
</html>
---------------------------------------------------------




----- Original Message ----- From: "Kenneth Skovhede, GEOGRAF A/S" <k...@geograf.dk>
To: "MapGuide Users Mail List" <mapguide-users@lists.osgeo.org>
Sent: Friday, November 27, 2009 12:35 PM
Subject: Re: [mapguide-users] Disable zoom and drag on one map,but not onother.


I don't think the information about the two avalible methods are correct.
Generally, for a MapGuide call, you can either supply SESSION= or USERNAME=&PASSWORD= The purpose of this is authentication, and either works (I think APPLYPACKAGE is different?).

You cannot use MAPNAME because that requires that you have pre-created a runtime map in the given session, and there is no HTTP interface to create or manipulate a runtime map.

Try tagging a valid SESSION= parameter to the GETMAPIMAGE call, and it should work well.
Alternatively try using USERNAME=Anonymous&PASSWORD=

Regards, Kenneth Skovhede, GEOGRAF A/S



Bojan Franc @ FER skrev:
Thx for help.

I am trying to use getMapImage now, it does exactly what I need.
I just cant get it working with SESSION and MAP parameters.

It says...
Session Id and Map Name
... or ...
Locale and Client Agent and Map Definition.

It works with the second set of parameters, but requires a login each time I open the page.

With Session Id and Map Name I get an error...

MgResourceNotFoundException
Resource was not found: Session:034a83a2-bd61-102c-8000-000c2993e1ac_en_7F0000010AFC0AFB0AFA//Demo.Map

I am using the same variables for calling the WebLayout of my detailed map, and it works fine. I also tried to copy/paste session and map name into MapAgent interface, but get the same error.

My variable shows me MapName "Demo", and the error says "Demo.Map". It added the ".Map" at the end of the string.

Where can I read more about getMapImage and similar API functions? I was looking for it in MapGuide Web API Reference and MapGuide Viewer API Reference but was unable to find anything related.

Regards,
   Bojan Franc


----- Original Message ----- From: "Kenneth Skovhede, GEOGRAF A/S" <k...@geograf.dk>
To: "MapGuide Users Mail List" <mapguide-users@lists.osgeo.org>
Sent: Thursday, November 19, 2009 8:56 AM
Subject: Re: [mapguide-users] Disable zoom and drag on one map, but not onother.


For the "static" map, you could simply use the GETMAPIMAGE call,
and then manually control layer visibility.

Basically:

1) On startup, create the MG session and runtime map
2) Create a html page with an <img> pointing to:
http://servername/mapaguide/mapagent/mapagent.fcgi?OPERATION=GETMAPIMAGE&SESSION=<sessionid>&MAPNAME=<runtimemapname>&seq=<random number> 3) Start a javascript that reloads the <img> with a new random number each 60 seconds 4) Provide controls to turn on/off layers and toggle these in server code

If you need a full viewer (eg, tile support, etc.), you can use OpenLayers to display the map, and disable the navigation controls. It would be a little bit difficult to use a standard WebLayout and disable all
mouse controls.

*) The GETMAPIMAGE call probably requires more parameters, check the test page:
http://localhost/mapguide/mapagent/index.html

Regards, Kenneth Skovhede, GEOGRAF A/S



bojanfr...@fer skrev:
Hi,

I need to make 2 maps. One windowed (small) with no ability to zoom or move.
The other full screen map with all the features MapGuide has.

First map should be a static map refreshing every 1 minute but users should not be able to zoom on it or move. It should be a "static" map. What the users should be able to do is to enable and disable some layers on the map,
nothing more. It's like a "demo" map for unregistered users.

The second map will be available to registered users displayed at full
screen with all Mapguide features enable.

Can it be done? If so, any help is appreciated.

I am using MGOS 2.1 with PHP.

Regards

_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to