Wrong parameter count for mgmap::open()

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrong parameter count for mgmap::open()

jayqueue
This post was updated on .
Hello,

I'm playing around with the Sheboygan sample data/PHP examples but I get
PHP Warning:  Wrong parameter count for mgmap::mgmap()
when I try to run something from the taskpane.

The samples are downloaded from
http://mapguide.osgeo.org/download/releases/*2.0.x*-samples -
and the installed server here is 3.1. Maybe that's what's wrong?

Is there any easy basic example? I typed so much in Google my fingers got a
bit shorter.
The only thing I found was this thread here:

http://osgeo-org.1560.x6.nabble.com/Getting-exception-with-Open-method-of-MgMap-Object-td4198727.html

there Kenneth says it has to be on runtime and pass it with the querystring
but it does that already.

http://some.server/mapguide/PHPSAMPLES/HELLO_MAP/display_spatial_reference.php?SESSION=597f199c-4177-11e9-8000-0050569a071b_en_MTI3LjAuMC4x0AFC0AFB0AFA&MAPNAME=Sheboygan

Specs:
MapGuide Server: 3.1
Windows Server 2012
PHP Version 5.6.23 (Came with the MapGuide Installation)
IIS

Can someone push me in the right direction with an easy example please?

Code:

   
    // Get the directory paths for this MapGuide installation
   
    require_once('../common/common.php');

    try
    {
      // --------------------------------------------------//
      // Basic initialization needs to be done every time.
     
      MgInitializeWebTier($webconfigFilePath);

      // Get the session information passed from the viewer.
     
      $args = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST : $_GET;
      $sessionId = $args['SESSION'];
      $mapName = $args['MAPNAME'];

      // 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);

      // Finished basic initialization.
      // --------------------------------------------------//
     
      // Query the spatial reference system used for the map.
     
      $map = new MgMap();
      $map->Open($resourceService, $mapName);
      $srs = $map->GetMapSRS();


--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: Wrong parameter count for mgmap::open()

jayqueue
So while browsing this forum I found this also:
http://osgeo-org.1560.x6.nabble.com/php-problems-with-3-x-td5394897.html
I'll give it a go.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: Wrong parameter count for mgmap::open()

Benoit Begin
Hi,

The issue is specifically for the new MgMap() line. The constructor for
MgMap was changed and the previous one was deprecated. You need to pass the
MgSiteConnection object when calling up the new MgMap().

So essentially you need new MgMap($siteConnection);

Hope this helps.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: Wrong parameter count for mgmap::open()

GordonL
In reply to this post by jayqueue
Like above,
the more recent versions require a different way of setting up the Map.

For example, I used to get the map this way:
    $map = new MgMap();
    $map->Open($resourceSrvc, $mapName);


Now you do it this way:
    $map = new MgMap($siteConnection);
    $map->Open($mapName);




--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users