= !MapGuide RFC 20 - New Query Features API - Part 2= This page contains an change request (RFC) for the !MapGuide Open Source project. More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||March 11, 2007|| ||Last Modified||Chris Claydon [[Timestamp]]|| ||Author||Chris Claydon|| ||RFC Status||draft|| ||Implementation Status||pending|| ||Proposed Milestone||1.2|| ||Assigned PSC guide(s)||(when determined)|| ||'''Voting History'''||(vote date)|| ||+1|||| ||+0|||| ||-0|||| ||-1|||| == Overview == This RFC describes a proposed modification to the new Query Features API to address a defect observed in the !MapGuide Viewer. == Motivation == When a feature is selected in the !MapGuide Viewer using the Search command, a susequent !QueryFeatures request is made to the !MapGuide Server in order to retrieve the properties for the selected feature. Any properties that are available are displayed in the viewer's property pane. The !QueryFeatures request is made using a spatial filter based on the geometry of the selected feature, with a !MaxFeatures value of 1. Thus, the properties that are displayed are those for the first feature that intersects the geometry of the selected feature. Unfortunately, this means that the properties that are retrieved are sometimes those of an adjacent feature instead of the selected feature. == Proposed Solution == The proposed solution is to modify the new API added by [wiki:MapGuideRfc15 MapGuide RFC 15] to include an additional string parameter containing a feature filter. This would allow the viewer to restrict the query only to the selected feature. The API method would be modified from this: {{{ MgFeatureInformation* QueryFeatures(MgMap* map, MgStringCollection* layerNames, MgGeometry* geometry, INT32 selectionVariant, INT32 maxFeatures, bool bIgnoreScaleRange); }}} to this: {{{ MgFeatureInformation* QueryFeatures(MgMap* map, MgStringCollection* layerNames, MgGeometry* geometry, INT32 selectionVariant, INT32 maxFeatures, bool bIgnoreScaleRange, CREFSTRING featureFilter); }}} This would allow the !QueryFeatures method to support queries containing either a spatial filter, or a feature filter, or both. The featureFilter parameter would take the form o an XML selection string, as used by the existing !MgSelection class. The Viewer code that issues the QueryFeatures request already has access to the selection string for the selected feature, which should make the implementation in the code relatively simple. In the Web Tier the HTTP operation, QUERYMAPFEATURES, would be extended to add support for a new request parameter, FEATUREFILTER. This parameter would contain a URL encoded version of the XML selection string from the viewer. == Implications == The documentation for this API will need to be updated. There are no compatibility issues because we have not yet released a version of MapGuide containing the API method to be modified. == Test Plan == Unit tests should cover the new API and new HTTP request parameters. == Funding/Resources == Funding and resources to be supplied by Autodesk.