|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
Selection Issue (FeatureReader only grabbing 20 items)Hi all,
This has just recently become a problem. I am passing the selection xml to a page to display parcel owner data. For an example, I select 256 parcels on the map. The selection xml comes over fine, with all 256 parcels listed. When I use a featureReader to get the parcel numbers from the features, It only get the first 20. Is this a setting I may have altered unintentionally, or could there be more to it? Here is the code that I am using to pull the information out from the selection xml: ======================================================================== function GetObjKeys($sessId,$mapName,$sel){ $obj_keys = ''; if($sel != ''){ InitializeWebTier(); $userInfo = new MgUserInformation($sessId); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInfo); $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $featureService = $siteConnection->CreateService(MgServiceType::FeatureService); $map = new MgMap($siteConnection); $map->Open($resourceService,$mapName); $selection = new MgSelection($map,$sel); if($selection != ''){ $layers = $selection->GetLayers(); if(!$layers){ $layers = $map->GetLayers(); } }else{ $layers = 0; } $layer = null; if($layers){ for($i = 0; $i < $layers->GetCount(); $i++){ if($layers->GetItem($i)->GetName() == "parcels"){ $layer = $layers->GetItem($i); } } $queryOptions = new MgFeatureQueryOptions(); if($layer){ $layerClassName = $layer->GetFeatureClassName(); if($sel != ''){ $selString = $selection->GenerateFilter($layer,$layerClassName); } $layerFeatureId = $layer->GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer->GetObjectId(); $queryOptions->SetFilter($selString); $featureReader = $featureService->SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); $selTmp = ''; for($pdx=0; $pdx<$featureReader->GetPropertyCount(); $pdx++){ $pnm = $featureReader->GetPropertyName($pdx); if($pnm == 'PARCEL_ID_'){ break; } if($pnm == 'PARCELID'){ break; } if($pnm == 'Key'){ break; } $pnm = ""; } if($pnm != ""){ while($featureReader->ReadNext()){ $stg = $featureReader->GetString($pnm); if($stg != ""){ $obj_keys .= "'" . $stg . "'"; } } } $obj_keys = str_replace("''","','",$obj_keys); } } return $obj_keys; }else{ return ''; } } |
|
|
RE: Selection Issue (FeatureReader only grabbing 20items)Yes, happens to me too here and there. No exceptions thrown, no errors
reported. I'm not talking to MG via XML (did that before), rather via JSON web services being called from client's JavaScript. I also noticed described reader mishaps while using Autodesk's MS SQL provider. What RDBMS are you using? Regards, Maksim Sestic -----Original Message----- From: mapguide-users-bounces@... [mailto:mapguide-users-bounces@...] On Behalf Of nclayton Sent: Monday, July 21, 2008 17:25 To: mapguide-users@... Subject: [mapguide-users] Selection Issue (FeatureReader only grabbing 20items) Hi all, This has just recently become a problem. I am passing the selection xml to a page to display parcel owner data. For an example, I select 256 parcels on the map. The selection xml comes over fine, with all 256 parcels listed. When I use a featureReader to get the parcel numbers from the features, It only get the first 20. Is this a setting I may have altered unintentionally, or could there be more to it? Here is the code that I am using to pull the information out from the selection xml: ======================================================================== function GetObjKeys($sessId,$mapName,$sel){ $obj_keys = ''; if($sel != ''){ InitializeWebTier(); $userInfo = new MgUserInformation($sessId); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInfo); $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $featureService = $siteConnection->CreateService(MgServiceType::FeatureService); $map = new MgMap($siteConnection); $map->Open($resourceService,$mapName); $selection = new MgSelection($map,$sel); if($selection != ''){ $layers = $selection->GetLayers(); if(!$layers){ $layers = $map->GetLayers(); } }else{ $layers = 0; } $layer = null; if($layers){ for($i = 0; $i < $layers->GetCount(); $i++){ if($layers->GetItem($i)->GetName() == "parcels"){ $layer = $layers->GetItem($i); } } $queryOptions = new MgFeatureQueryOptions(); if($layer){ $layerClassName = $layer->GetFeatureClassName(); if($sel != ''){ $selString = $selection->GenerateFilter($layer,$layerClassName); } $layerFeatureId = $layer->GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer->GetObjectId(); $queryOptions->SetFilter($selString); $featureReader = $featureService->SelectFeatures($layerFeatureResource,$layerClassName,$query Options); $selTmp = ''; for($pdx=0; $pdx<$featureReader->GetPropertyCount(); $pdx++){ $pnm = $featureReader->GetPropertyName($pdx); if($pnm == 'PARCEL_ID_'){ break; } if($pnm == 'PARCELID'){ break; } if($pnm == 'Key'){ break; } $pnm = ""; } if($pnm != ""){ while($featureReader->ReadNext()){ $stg = $featureReader->GetString($pnm); if($stg != ""){ $obj_keys .= "'" . $stg . "'"; } } } $obj_keys = str_replace("''","','",$obj_keys); } } return $obj_keys; }else{ return ''; } } -- View this message in context: http://www.nabble.com/Selection-Issue-%28FeatureReader-only-grabbing-20-item s%29-tp18570994p18570994.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@... http://lists.osgeo.org/mailman/listinfo/mapguide-users __________ NOD32 3281 (20080718) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com _______________________________________________ mapguide-users mailing list mapguide-users@... http://lists.osgeo.org/mailman/listinfo/mapguide-users |
|
|
RE: Selection Issue (FeatureReader only grabbing 20items)I'm using MySQL, though at this point in the process I'm not doing anything with the database.
|
|
|
Re: Selection Issue (FeatureReader only grabbing 20 items)Earlier it was suggested by Jonathon...
Check out the serverconfig.ini file...there is a new setting in there that limits it.
|
|
|
RE: Selection Issue (FeatureReader only grabbing20items)You don't, but MG does.
-----Original Message----- From: mapguide-users-bounces@... [mailto:mapguide-users-bounces@...] On Behalf Of nclayton Sent: Monday, July 21, 2008 17:42 To: mapguide-users@... Subject: RE: [mapguide-users] Selection Issue (FeatureReader only grabbing20items) I'm using MySQL, though at this point in the process I'm not doing anything with the database. Maksim Sestic wrote: > > Yes, happens to me too here and there. No exceptions thrown, no errors > reported. I'm not talking to MG via XML (did that before), rather via > JSON web services being called from client's JavaScript. I also > noticed described reader mishaps while using Autodesk's MS SQL > provider. What RDBMS are you using? > > Regards, > Maksim Sestic > > > -----Original Message----- > From: mapguide-users-bounces@... > [mailto:mapguide-users-bounces@...] On Behalf Of nclayton > Sent: Monday, July 21, 2008 17:25 > To: mapguide-users@... > Subject: [mapguide-users] Selection Issue (FeatureReader only grabbing > 20items) > > > Hi all, > This has just recently become a problem. I am passing the selection > xml to a page to display parcel owner data. For an example, I select > 256 parcels on the map. The selection xml comes over fine, with all > 256 parcels listed. > When I use a featureReader to get the parcel numbers from the > features, It only get the first 20. > > Is this a setting I may have altered unintentionally, or could there > be more to it? > > Here is the code that I am using to pull the information out from the > selection xml: > ====================================================================== > == function GetObjKeys($sessId,$mapName,$sel){ > $obj_keys = ''; > if($sel != ''){ > InitializeWebTier(); > $userInfo = new MgUserInformation($sessId); > $siteConnection = new MgSiteConnection(); > $siteConnection->Open($userInfo); > $resourceService = > $siteConnection->CreateService(MgServiceType::ResourceService); > $featureService = > $siteConnection->CreateService(MgServiceType::FeatureService); > $map = new MgMap($siteConnection); > $map->Open($resourceService,$mapName); > $selection = new MgSelection($map,$sel); > if($selection != ''){ > $layers = $selection->GetLayers(); > if(!$layers){ $layers = $map->GetLayers(); } > }else{ $layers = 0; } > $layer = null; > if($layers){ > for($i = 0; $i < $layers->GetCount(); $i++){ > if($layers->GetItem($i)->GetName() == "parcels"){ $layer = > $layers->GetItem($i); } > } > $queryOptions = new MgFeatureQueryOptions(); > if($layer){ > $layerClassName = $layer->GetFeatureClassName(); > if($sel != ''){ $selString = > $selection->GenerateFilter($layer,$layerClassName); } > $layerFeatureId = $layer->GetFeatureSourceId(); > $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); > $layerId = $layer->GetObjectId(); > $queryOptions->SetFilter($selString); > $featureReader = > > Options); > $selTmp = ''; > for($pdx=0; $pdx<$featureReader->GetPropertyCount(); $pdx++){ > $pnm = $featureReader->GetPropertyName($pdx); > if($pnm == 'PARCEL_ID_'){ break; } > if($pnm == 'PARCELID'){ break; } > if($pnm == 'Key'){ break; } > $pnm = ""; > } > if($pnm != ""){ > while($featureReader->ReadNext()){ > $stg = $featureReader->GetString($pnm); > if($stg != ""){ $obj_keys .= "'" . $stg . "'"; } > } > } > $obj_keys = str_replace("''","','",$obj_keys); > } > } > return $obj_keys; > }else{ return ''; } > } > -- > View this message in context: > http://www.nabble.com/Selection-Issue-%28FeatureReader-only-grabbing-2 > 0-item > s%29-tp18570994p18570994.html > Sent from the MapGuide Users mailing list archive at Nabble.com. > > _______________________________________________ > mapguide-users mailing list > mapguide-users@... > http://lists.osgeo.org/mailman/listinfo/mapguide-users > > __________ NOD32 3281 (20080718) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > > _______________________________________________ > mapguide-users mailing list > mapguide-users@... > http://lists.osgeo.org/mailman/listinfo/mapguide-users > > -- View this message in context: http://www.nabble.com/Selection-Issue-%28FeatureReader-only-grabbing-20-item s%29-tp18570994p18571366.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@... http://lists.osgeo.org/mailman/listinfo/mapguide-users __________ NOD32 3281 (20080718) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com _______________________________________________ mapguide-users mailing list mapguide-users@... http://lists.osgeo.org/mailman/listinfo/mapguide-users |
|
|
Re: Selection Issue (FeatureReader only grabbing 20 items)I altered the value for SelectionFilterSize and set it to 9999 then restarted the MapGuide service.
I'm still only getting the first 20.
|
|
|
Re: Selection Issue (FeatureReader only grabbing 20 items)You also need to modify the SelectionFilterSize value in webconfig.ini file.
|
|
|
Re: Selection Issue (FeatureReader only grabbing 20 items)No change, stll only getting 20 of the records...
I've changed SelectionFilterSize in both serverconfig.ini and webconfig.ini and restarted the service.
|
|
|
RE: Selection Issue (FeatureReader only grabbing 20 items)Your code is calling MgSelection::GenerateFilters() which has limitation in that it only generates a filter for the first 20 items. This limitation was introduced by http://trac.osgeo.org/mapguide/changeset/3053.
A follow up submission to address this added a temporary, undocumented API, GenerateFilters to resolve the limitation. See http://trac.osgeo.org/mapguide/ticket/501. To workaround the issue until a fix for GenerateFilter is available, you can use the undocumented GenerateFilters to create the filters, and then perform your selection based on each of the filters. Iterate through the features in each feature reader to get all your features. Please be aware this is offered only as a workaround until GenerateFilter is fixed. Have a look at http://svn.osgeo.org/mapguide/branches/2.0.x/MgDev/Web/src/mapviewerphp/buffer.php for a sample of how to use the GenerateFilters method to setup the query for selection. Ronnie -----Original Message----- From: nclayton [mailto:nclayton@...] Sent: Monday, July 21, 2008 9:25 AM To: mapguide-users@... Subject: [mapguide-users] Selection Issue (FeatureReader only grabbing 20 items) Hi all, This has just recently become a problem. I am passing the selection xml to a page to display parcel owner data. For an example, I select 256 parcels on the map. The selection xml comes over fine, with all 256 parcels listed. When I use a featureReader to get the parcel numbers from the features, It only get the first 20. Is this a setting I may have altered unintentionally, or could there be more to it? Here is the code that I am using to pull the information out from the selection xml: ======================================================================== function GetObjKeys($sessId,$mapName,$sel){ $obj_keys = ''; if($sel != ''){ InitializeWebTier(); $userInfo = new MgUserInformation($sessId); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInfo); $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $featureService = $siteConnection->CreateService(MgServiceType::FeatureService); $map = new MgMap($siteConnection); $map->Open($resourceService,$mapName); $selection = new MgSelection($map,$sel); if($selection != ''){ $layers = $selection->GetLayers(); if(!$layers){ $layers = $map->GetLayers(); } }else{ $layers = 0; } $layer = null; if($layers){ for($i = 0; $i < $layers->GetCount(); $i++){ if($layers->GetItem($i)->GetName() == "parcels"){ $layer = $layers->GetItem($i); } } $queryOptions = new MgFeatureQueryOptions(); if($layer){ $layerClassName = $layer->GetFeatureClassName(); if($sel != ''){ $selString = $selection->GenerateFilter($layer,$layerClassName); } $layerFeatureId = $layer->GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer->GetObjectId(); $queryOptions->SetFilter($selString); $featureReader = $featureService->SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); $selTmp = ''; for($pdx=0; $pdx<$featureReader->GetPropertyCount(); $pdx++){ $pnm = $featureReader->GetPropertyName($pdx); if($pnm == 'PARCEL_ID_'){ break; } if($pnm == 'PARCELID'){ break; } if($pnm == 'Key'){ break; } $pnm = ""; } if($pnm != ""){ while($featureReader->ReadNext()){ $stg = $featureReader->GetString($pnm); if($stg != ""){ $obj_keys .= "'" . $stg . "'"; } } } $obj_keys = str_replace("''","','",$obj_keys); } } return $obj_keys; }else{ return ''; } } -- View this message in context: http://www.nabble.com/Selection-Issue-%28FeatureReader-only-grabbing-20-items%29-tp18570994p18570994.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@... http://lists.osgeo.org/mailman/listinfo/mapguide-users |
|
|
RE: Selection Issue (FeatureReader only grabbing 20 items)Thank you for pointing this out Ronnie, doubt I would've found them myself.
Kind of a harsh workaround, significant modification to my code for something that looks like it will be gone in the next update. I'll post my workaround code here for anyone else needing the fix.
|
|
|
RE: Selection Issue (FeatureReader only grabbing 20 items)Here is my altered code to incorporate the workaround:
============================================= function GetObjKeys($sessId,$mapName,$sel,$scnt){ $obj_keys = ''; if($sel != ''){ InitializeWebTier(); $userInfo = new MgUserInformation($sessId); $siteConnection = new MgSiteConnection(); $siteConnection->Open($userInfo); $resourceService = $siteConnection->CreateService(MgServiceType::ResourceService); $featureService = $siteConnection->CreateService(MgServiceType::FeatureService); $map = new MgMap($siteConnection); $map->Open($resourceService,$mapName); $selection = new MgSelection($map,$sel); if($selection != ''){ $layers = $selection->GetLayers(); if(!$layers){ $layers = $map->GetLayers(); } }else{ $layers = 0; } $layer = null; if($layers){ for($i = 0; $i < $layers->GetCount(); $i++){ if($layers->GetItem($i)->GetName() == "parcels"){ $layer = $layers->GetItem($i); } } $queryOptions = new MgFeatureQueryOptions(); if($layer){ $layerClassName = $layer->GetFeatureClassName(); // Check the $selection object for the GenerateFilters method // If it exists, use it to generate the $selString, otherwise // use the GenerateFilter method if($sel != ''){ if(method_exists($selection,'GenerateFilters')){ $filters = $selection->GenerateFilters($layer,$layerClassName,$scnt); $selString = $filters->GetItem(0); }else{ $selString = $selection->GenerateFilter($layer,$layerClassName); } } $layerFeatureId = $layer->GetFeatureSourceId(); $layerFeatureResource = new MgResourceIdentifier($layerFeatureId); $layerId = $layer->GetObjectId(); $queryOptions->SetFilter($selString); $featureReader = $featureService->SelectFeatures($layerFeatureResource,$layerClassName,$queryOptions); $selTmp = ''; for($pdx=0; $pdx<$featureReader->GetPropertyCount(); $pdx++){ $pnm = $featureReader->GetPropertyName($pdx); if($pnm == 'PARCEL_ID_'){ break; } if($pnm == 'PARCELID'){ break; } if($pnm == 'Key'){ break; } $pnm = ""; } if($pnm != ""){ while($featureReader->ReadNext()){ $stg = $featureReader->GetString($pnm); if($stg != ""){ $obj_keys .= "'" . $stg . "'"; } } } $obj_keys = str_replace("''","','",$obj_keys); } } return $obj_keys; }else{ return ''; } } |
| Free Forum Powered by Nabble | Forum Help |