[mapguide-users] Shareable query

Rahul unicorn_admirer at yahoo.com
Tue Jun 3 08:12:10 EDT 2008


Hi ,
      Do the Following to get going with the Sample GT Application on MGOS2.1.0  (API Change).
 
                 1.Query Task--Change the query.php File
                 2.Theme Task-No Change works perfectly ok
                 3.Markup Task-Change the markupeditor.php File
 
-------------------------------------------------------------------------------------------------------
1.Change thefunction Execute() in the query.php file at C:\ProgramFiles\MapGuideOpenSource2.\WebServerExtensions\www\phpviewersample\query\classes 

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

------------------------------------------------------------------------------------------------
3.  Change function GetTransform() in the markupeditor.php file at
C:\ProgramFiles\MapGuideOpenSource2.\WebServerExtensions\www\phpviewersample\markup\classes 
 
function GetTransform()
 {
  $coordSysFactory = new MgCoordinateSystemFactory();
  $resourceService =
 $this->site->CreateService(MgServiceType::ResourceService);
  
  $map = new MgMap();
  $map->Open($resourceService, $this->args['MAPNAME']);
  
  $source = $coordSysFactory->Create($map->GetMapSRS()); 
  $target = $coordSysFactory->Create(MarkupManager::LL84WKT);
 
  return $coordSysFactory->GetTransform($source, $target); 

  // return new MgCoordinateSystemTransform($source, $target);
    }

-----------------------------------------------------------------------------------------------
 
Cheers 
Max !!


----- Original Message ----
From: Jason Birch <Jason.Birch at nanaimo.ca>
To: MapGuide Users Mail List <mapguide-users at lists.osgeo.org>
Sent: Tuesday, June 3, 2008 11:52:21 AM
Subject: RE: [mapguide-users] Shareable query

querycontroller.php is erroring out on you on the site you posted earier -- 127.0.0.1 didn't work for me :)

Anything in the apache error log, or in the php error log (assuming you have it enabled)?

Once you get this all working, it would be great to see a trac ticket describing what was wrong with the GT sample, and what you did to fix it:

http://trac.osgeo.org/mapguide/wiki/SubmitTicket <http://trac.osgeo.org/mapguide/wiki/SubmitTicket> 

Jason

________________________________

From: erictsn <mailto:erictsn at cadbeyond.com> 
Subject: [mapguide-users] Shareable query

Now I working on query functionality. It can't to query the result. DO you
have idea? I have captured a sort of access.log file:


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080603/9dcaf55c/attachment.html


More information about the mapguide-users mailing list