[mapguide-commits] r8287 - branches/2.6/MgDev/Doc/samples/phpsamples/working_with_feature_data
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Jul 9 01:38:27 PDT 2014
Author: jng
Date: 2014-07-09 01:38:27 -0700 (Wed, 09 Jul 2014)
New Revision: 8287
Modified:
branches/2.6/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php
Log:
Fix broken sample code in light of the Sheboygan dataset update.
Modified: branches/2.6/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php
===================================================================
--- branches/2.6/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php 2014-07-09 06:26:54 UTC (rev 8286)
+++ branches/2.6/MgDev/Doc/samples/phpsamples/working_with_feature_data/selectfeatures.php 2014-07-09 08:38:27 UTC (rev 8287)
@@ -36,6 +36,9 @@
$args = ($_SERVER['REQUEST_METHOD'] == "POST")? $_POST : $_GET;
$sessionId = $args['SESSION'];
$mapName = $args['MAPNAME'];
+ $selectionXml = '';
+ $idName = "";
+ $geomName = "";
try
{
@@ -53,15 +56,21 @@
$map->Open($mapName);
// Get the geometry for the boundaries of District 1
+ $layer = $map->GetLayers()->GetItem('Districts');
+
+ // Use the layer's class definition to determine its identity property and geometry property name
+ $clsDef = $layer->GetClassDefinition();
+ $idProps = $clsDef->GetIdentityProperties();
+ $idProp = $idProps->GetItem(0);
+ $idName = $idProp->GetName();
+ $geomName = $clsDef->GetDefaultGeometryPropertyName();
$districtQuery = new MgFeatureQueryOptions();
- $districtQuery->SetFilter("Autogenerated_SDF_ID = 1");
+ $districtQuery->SetFilter("$idName = 1");
- $layer = $map->GetLayers()->GetItem('Districts');
$featureReader = $layer->SelectFeatures($districtQuery);
$featureReader->ReadNext();
- $districtGeometryData = $featureReader->
- GetGeometry('Data');
+ $districtGeometryData = $featureReader->GetGeometry($geomName);
// Convert the AGF binary data to MgGeometry.
More information about the mapguide-commits
mailing list