= FDO RFC 38 - Multi-polygon support for SHP = This page contains an change request (RFC) for the FDO Open Source project. More FDO RFCs can be found on the [wiki:FDORfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date|| June 08, 2009 || ||Last Modified|| Dan Stoica[[Timestamp]]|| ||Author||Dan Stoica, Orest Halustchak || ||RFC Status||Adopted|| ||Implementation Status||draft|| ||Proposed Milestone||3.5.0.0|| ||Assigned PSC guide(s)||Greg Boone|| ||'''Voting History'''|| || ||+1||Haris, Frank, Jackie, Traian, Greg, Orest, Jason || ||+0|| || ||-0|| || ||-1|| || == Overview == This RFC is for adding the FDO SHP provider capability to support multi-polygons geometries in the cases where SHP files have multi-polygons. == Motivation == Currently, this provider supports only simple polygons. The SHP specification defines only a polygon type, but it defines it as supporting multiple outer polygon loops, which basically are multi-polygons as defined in FDO. So a SHP polygon can be either an FDO polygon or an FDO multi-polygon, depending on the number of outer loops. The FDO SHP provider is not taking advantage of this and is not returning multi-polygons when the polygons are actual multi-polygons. The main processing that is missing with the current provider is on read, it does not check the polygon details to determine whether to generate an FDO polygon or an FDO multi-polygon geometry. == Proposed Solution == Modify the FDO SHP provider: * Change its capability setting to indicate that it supports multi-polygon geometry types, FdoIGeometryCapabilities::!GetGeometryTypes().[[BR]] * On input of geometry, there is no further processing needed as the current code will save all input loops without checking whether they are outer or inner.[[BR]] * On read of geometry, the code should check the geometry to see if there are multiple loops. If there are multiple loops, determine if there are more than one outer loops. If so, change the output geometry type to FDO multi-polygon, otherwise, leave it as polygon with interior rings.[[BR]] * If any loops of a geometry are not closed, then the current behavior of not changing the geometry at all is followed. The geometry is returned as-is.[[BR]] == Implications == * The code for this is mostly done, just turned off. We will need to measure and work on any performance impact, but the extra processing would only apply for cases where there are multiple loops. The most common case of a single loop polygon would not be processed any differently and would not have a performance impact. * The FDO geometry type will be set accordingly on reading. The caller must expect either a polygon or a multi-polygon regardless of original geometry type on insert. * This is a behavior change to the SHP provider. Before this change, SHP would return only polygon types. It would never return something called a multi-polygon. After the change, SHP will return either polygons or multi-polygons. Previously a layer from a polygon SHP file would have only polygons, now it could have polygons, multi-polygons or both. This change could occur with existing data and layers, e.g. stylization rules that handle polygons and multi-polygons differently may see a change. == Test Plan == * Enhance the unit test and add roundtripping fidelity tests. * Performance benchmarks on large datasets containing polygons with many rings. == Funding/Resources == Autodesk to provide resources / funding.