[mapguide-users] Newbie problem with SetFilter

Kenneth, GEOGRAF A/S ks at geograf.dk
Tue Sep 12 11:51:53 EDT 2006


A quick guess, you must supply the Feature Class, not the layer name:

$featureClass = map.GetLayers().GetItem('wltg_lin').GetFeatureClassName();

With that, you may know replace your select with:

$featureReader = $featureService->SelectFeatures($featureResId, $featureClass, $Optionen);


Hope that helps.

Mvh. Kenneth, GEOGRAF A/S




peter56 skrev:
> Hallo,
>
> here a typical newbie problem with the application of the sample code.
>
> Like in the php-sample "Server-side Selection" (pages 47-49) I have tried to
> select my own data. But the code don't work:
>
> ...
>      MgInitializeWebTier("$extensionsDir\webconfig.ini");
>      $webLayout = "Library://downtown/Layouts/downtwon_layout1.WebLayout";
>      $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, $mapName);
>      $Optionen = new MgFeatureQueryOptions();
>      $Optionen->SetFilter("MAT LIKE 'PVC%'");
>      $featureResId = new
> MgResourceIdentifier("Library://downtown/Data/wltg_lin.FeatureSource");
>      $featureReader = $featureService->SelectFeatures($featureResId,
> 'wltg_lin', $Optionen);
> ...
>
> "wltg_lin" is the name of the layer and the name of the data-source. "MAT"
> is an datafield and "PVC" a datavalue. 
>
> All data was generated by shp-files (exported from Autodesk MAP).
>
> I'm working with XP, MG OS 1.0.1, Apache and php.
>
> Please help to find my mistake.
>
> Thanks in advance - Peter
>   




More information about the Mapguide_users mailing list