[mapguide-users] try to update
SDF FeatureSource...mycode don'twork.
Maciej Skorczewski
maciej.skorczewski at procad.pl
Tue Mar 6 09:53:57 EST 2007
ok so i add this - (in IE) - now xml said that on SDF source can make
update
but
now still can't update SDF file. :(
php script work very long whitout any results...
this is my PHP code...in all faq i can't find clear and easy example...
<?
$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