[mapguide-trac] #199: BUG in SetSelectionXML on layer from database (PostgreSQL->PostgGIS)

MapGuide Open Source trac_mapguide at osgeo.org
Tue Jun 12 06:32:56 EDT 2007


#199: BUG in SetSelectionXML on layer from database (PostgreSQL->PostgGIS)
------------------------+---------------------------------------------------
   Reporter:  maciek    |       Owner:       
       Type:  defect    |      Status:  new  
   Priority:  high      |   Milestone:  1.3  
  Component:  General   |     Version:  1.2.0
   Severity:  critical  |    Keywords:       
External_id:            |  
------------------------+---------------------------------------------------
 Hi

 I try make SetSelectionXML method on my layer who come from PostGIS
 (PostgreSQL database).

 I make it whit SHP and all works fine...i get corect xml of selected
 polygon...after call it MG make selection...


 BUT.

 When i try this whit layer who are in PostGIS i get bad xml (it is not
 completed)


 this xml come from SHP file:

 {{{

 <?xml version="1.0" encoding="UTF-8"?>
 <FeatureSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd">
 <Layer id="5b908772-0000-1000-8002-0019d10e3e0f">
 <Class id="SHP_Schema:RoadCenterLines">
 <ID>DgEAAA==</ID></Class></Layer></FeatureSet>
 }}}



 this xml come from PostGIS.

 {{{

 <?xml version="1.0" encoding="UTF-8"?>
 <FeatureSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd">
 </FeatureSet>
 }}}




 what is wrong whit that?

 take a look on my code.


 {{{

 ------- php code begin----------------

 MgInitializeWebTier ($configFilePath);
 $userInfo = new MgUserInformation($mgSessionId);
 $siteConnection = new MgSiteConnection();
 $siteConnection->Open($userInfo);

 $resourceService=$siteConnection->CreateService(MgServiceType::ResourceService);
 $featureService=$siteConnection->CreateService(MgServiceType::FeatureService);



 $map = new MgMap();
 $map->Open($resourceService, 'budynek2_db');
 $pomQuery = new MgFeatureQueryOptions();
 $pomQuery->SetFilter("Ogc_fid = '".trim($key)."'");

 //i get db connection to postgis
 //normaly it should be shp source

 $pomResId = new
 MgResourceIdentifier("Library://budynek2/db_postgres/db.FeatureSource");

 //this is my layer
 $featureReader = $featureService->SelectFeatures($pomResId,
 "SDF_2_Schema:0x_poziom_0", $pomQuery);

 $layer = $map->GetLayers()->GetItem('0x_poziom_0');
 $selection = new MgSelection($map);
 $selection->AddFeatures($layer, $featureReader, 0);
 $selectionXml = $selection->ToXml();

 echo "<script type='text/javascript'>\n function OnPageLoad() {\n";
 echo "selectionXml = '$selectionXml';\n
 parent.SetSelectionXML(selectionXml);\n";
 echo "$selectionXml";
 echo "}\n</script>";



 ------- php code end----------------
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/199>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list