[mapguide-users] try to update SDF FeatureSource...my code don't work.

Maciej Skorczewski maciej.skorczewski at procad.pl
Fri Mar 2 09:25:14 EST 2007


hi all!

i try update SDF FeatureSource (Roads name of Samples/Sheboygan data 
form MGOS download page) whithout any results
this i may PHP code...it don't show any error but eny results too...can 
somebody what is going on whit that?


<?
$mgSessionId = ($_SERVER['REQUEST_METHOD'] == "POST")? 
$_POST['SESSION']: $_GET['SESSION'];

try
{
include 'appconstants.php';
MgInitializeWebTier ($configFilePath);
$userInfo = new MgUserInformation($mgSessionId);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($userInfo);

$resourceService = 
$siteConnection->CreateService(MgServiceType::ResourceService);
$map = new MgMap();
$map->Open($resourceService, 'Sheboygan');


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

$resId = new 
MgResourceIdentifier("Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource");

$featureReader = 
$featureService->SelectFeatures($resId,"RoadCenterLines", null);

$filter = "ID LIKE '%%'";
$featureResId = new 
MgResourceIdentifier("Library://Samples/Sheboygan/Data/RoadCenterLines.FeatureSource");

$queryOptions = new MgFeatureQueryOptions();
$queryOptions->SetFilter($filter);


$featureReader = $featureService->SelectFeatures($featureResId, 
"RoadCenterLines", $queryOptions);
		
	
	
while ($featureReader->ReadNext())
{
   $NAME = $featureReader->GetString('NAME');

//---------------------------------
//-----lets start update
//---------------------------------
$filter2 = "ID=2536" ;
$blueMarkerCommands = new MgFeatureCommandCollection();
	
$properties = new MgPropertyCollection();
$properties->Add(new MgStringProperty("NAME", 'nowa'));
$updateCommand = new MgUpdateFeatures("RoadCenterLines", $properties, 
$filter2);
$blueMarkerCommands->Add($updateCommand);
$featureService->UpdateFeatures($featureResId, $blueMarkerCommands,false);
$map->Save($resourceService);
//---------------------------------
//-----end of update
//---------------------------------
}
$featureReader->Close();


}
catch (MgException $e)
{
  echo $e->GetMessage();
  echo $e->GetDetails();
}
?>


maciek


More information about the mapguide-users mailing list