While doing some work with shapefiles containing very large polygons with
huge numbers of holes, I noticed some issues with the Shapefile reader
code.  (I was working with an old, old version of the shapefile code, but
they still apply to the current GeoTools version).

The issues are in PolygonHandler.  They only apply in the case of a
MultiPolygon where at least one component has holes (since GeoTools has a
short-circuit for the case of a single Polygon, which avoids these issues).

- Each hole is checked to see what shell contains it.  The current check is
linear in the size of the shell, which is slow if there are many holes.
 JTS now has an indexed Point-in-Poly routine which would speed things up
in this case.
- the ArrayList indexOf method is used to look up the index of the
containing shell.  This method is slow, since it uses equals rather than
reference equality (which is all that's needed in this case).  It could be
replaced with a simple iteration over the array with a reference comparison.

Since these only apply to MultiPolygons with holes, this is probably very
much a corner case.  But when they bite, they're bad.

-- 
Martin Davis
OpenGeo - http://opengeo.org
Expert service straight from the developers.
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to