[mapguide-users] Dynamic Query Task Fails in MGOS 2.0.1

Rahul unicorn_admirer at yahoo.com
Wed May 28 23:05:39 EDT 2008


Hi Don,
                Regarding the Dynamic query Task you can change the query.php file in the D:\Program Files\MapGuideOpenSource2.0\WebServerExtensions\www\phpviewersample\query\classes  as there is some change due to the RFC35 and have to use -->
MgCoordinateSystemFactory::GetTransform should be used instead of the deleted MgCoordinateSystemTransform constructor,
So your code in the Function Execute will be --
function Execute()
 {
  $result = array();
  $resourceService = $this->site->CreateService(MgServiceType::ResourceService);
  $map = new MgMap();
  $map->Open($resourceService, $this->args['MAPNAME']);
        $layer = $map->GetLayers()->GetItem($this->args['LAYERNAME']);
  $featureService = $this->site->CreateService(MgServiceType::FeatureService);
        $resId = new MgResourceIdentifier($layer->GetFeatureSourceId());
  $featureClass = $layer->GetFeatureClassName();
  $featureGeometry = $layer->GetFeatureGeometryName();
  // Initialize the coordinate system transform
  $schemaAndClass = explode(":", $featureClass);
  $classDef = $featureService->GetClassDefinition($resId, $schemaAndClass[0], $schemaAndClass[1]);
  $geomProp = $classDef->GetProperties()->GetItem($featureGeometry);
  $spatialContext = $geomProp->GetSpatialContextAssociation();
  $csTransform = null;
  $csInverseTransform = null;
  $coordSysFactory = new MgCoordinateSystemFactory();
  $scReader = $featureService->GetSpatialContexts($resId, false);
  while ($scReader->ReadNext() && $csTransform == null)
  {
   if ($scReader->GetName() == $spatialContext)
   {
    $source = $coordSysFactory->Create($scReader->GetCoordinateSystemWkt());
    $target = $coordSysFactory->Create($map->GetMapSRS());
              
    $csTransform=$coordSysFactory->GetTransform($source, $target);
    $csInverseTransform=$coordSysFactory->GetTransform($target, $source);
    //$csTransform = new MgCoordinateSystemTransform($source, $target);
    //$csInverseTransform = new MgCoordinateSystemTransform($target, $source);
    
    
   }
  }
This allow me to query and get the results but the stranged thing is happening that in one machine with (Windows XP+Apache+PHP) , I can query and select the results while in the other machine with Windows2003+Apache+Php, I can query but unable to select the features and use to get the error in the apache log file.
Uncaught exception 'mgobjectnotfoundexception' in Unknown on line 0, referer:
 http://10.0.x.xx:8008/mapguide/phpviewersample/query/querymain.php

Anyway Don you can give a try and i hope it will work for you if u r using windows XP +Apache+Php..
Max!!


----- Original Message ----
From: Don C. MacGregor <sir_sunkee at yahoo.ca>
To: mapguide-users at lists.osgeo.org
Sent: Wednesday, May 28, 2008 9:08:52 PM
Subject: Re: [mapguide-users] Dynamic Query Task Fails in MGOS 2.0.1


Hi Max,
I was too busy to research so I restored my MGOS 1.2 installation.


max_samart wrote:
> 
> Hi All,
>          Finally  I able to manage toperform search and get results using
> the phpviewersample Query Task after changing few lines of codes from the
> original one, but once i use the Select Button ,it doesn't use to select
> feature and in the Apache Error.log file use to give the following error.
> -------------------------------------------------------------------------------------------------------
> [Wed May 28 16:45:06 2008] [error] [client 10.0.x.xx] PHP Fatal error: 
> Uncaught exception 'mgobjectnotfoundexception' in Unknown on line 0,
> referer:
> http://10.0.x.xx:8008/mapguide/phpviewersample/query/querymain.php
> --------------------------------------------------------------------------------------------------------
> 
> Can anybody tell me how to move forward or can give any kind of idea for
> the possible cause of error.Hey Don have you got going with your custom
> scripts in MGOS2.0.1 ,which was previously working with MGOS1.2.
> Thks
> Max !!
> 
> ----- Original Message ----
> From: Rahul <unicorn_admirer at yahoo.com>
> To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
> Sent: Tuesday, May 27, 2008 10:23:57 AM
> Subject: [mapguide-users] Dynamic Query Task Fails in MGOS 2.0.1
> 
> 
> Hi All,
>                I downloaded theMGOS 2.0.1 and tried with the sample
> data-Shebogyan.mgp  with  the supplied phpviewersample for MGOS2.0.1 ,but
> I unable to perform the query task on the  sample data.I am using Win2K3,
> Apache and PHP. Can anybody confirm about this or its just happening on my
> setup or i am missing something/configured something wrong.
>  
> Thks
> Max
> 
> 
> 
> _______________________________________________
> 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/Dynamic-Query-Task-Fails-in-MGOS-2.0.1-tp17482346p17513475.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



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080528/93e385b5/attachment.html


More information about the mapguide-users mailing list