Enabling densification on reprojection can cause OOMs with large/complex geometries, and requests hitting small areas


The case is having a very large polygon (natural earth land has a multipolygon covering all the major dry lands), and reprojecting it with densification to a local area projection, such as UTM32, with densification enabled, while asking for a very small area:

  • The calculation of the densification factors fails due to a bug in WarpBuilder, leaving the densification factors undetermined

  • A default is picked, one point every 5 pixels out of the very small area

  • APH is applied to the original geometry clipped on the valida area of UTM, causing an explosion of points due to the mismatch between the requested resolution, and the massive polygon (much bigger than the requested area)

  • If the above is not able to cause an OOM per se, the Densifier runs a buffer(0) at the end of the calculation, to make sure the returned geometry is valid, causing an even greater memory usage

Two observations:

  • The simple bug in determining the densification distance should be fixed

  • The extra effort/memory of calling buffer(0) should be removed, the geometry is used for rendering only (JTS 1.18, available on master, allows to skip that part)




Andrea Aime


Andrea Aime