[mapguide-users] PostgreSQL SelectFeatures
Kori Maleski
kori.maleski at gmail.com
Wed Nov 18 13:25:59 PST 2015
To get the Fusion buffer (or other widgets) to work with tables that contain
incompatible column data types (PostgreSQL or any FDO FeatureSource for
that matter):
Modify Buffer.php so as to select compatible columns:
...
$featureClassName = $selLayer->GetFeatureClassName();
$filter = $sel->GenerateFilter($selLayer, $featureClassName);
if($filter == "")
continue;
$query = new MgFeatureQueryOptions();
$query->SetFilter($filter);
$classDef = $selLayer->GetClassDefinition();
$geomPropName = $classDef->GetDefaultGeometryPropertyName();
$propertyList = $classDef->GetProperties();
for($i=0; $i<$propertyList->GetCount(); $i++)
{
$propertyDef = $propertyList->GetItem($i);
$property = $propertyList->GetItem($i)->GetName();
if(($property!=$geomPropName)&&($propertyDef->GetPropertyType()==100))
{
$propertyType = $propertyList->GetItem($i)->GetDataType();
switch ($propertyType) {
case MgPropertyType::Boolean :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::Byte :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::DateTime :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::Single :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::Double :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::Int16 :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::Int32 :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::Int64 :
$query->AddFeatureProperty($property);
break;
case MgPropertyType::String :
$query->AddFeatureProperty($property);
break;
}
}else if($property==$geomPropName){
$query->AddFeatureProperty($property);
}
}
$featureSource = new
MgResourceIdentifier($selLayer->GetFeatureSourceId());
$features = $featureSrvc->SelectFeatures($featureSource,
$featureClassName, $query);
if($features->ReadNext())
...
The same would have to be done in the Mapguide/Web/schemareport folder for
showclass.php as well as other instances where SelectFeatures is utilized.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/PostgreSQL-SelectFeatures-tp5236983p5237280.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list