mapnik-org/mapnik — Issue #136: Don't query layer extent unless re-projecting
Author: artemp
Created: 2011-10-11 07:37:39+00:00
State: open
Labels: Core_Library

Currently, the following SQL is called for every single map rendering when using the postgis plugin:
{{{
select xmin(ext),ymin(ext),xmax(ext),ymax(ext)
from (select extent(mygeom) as ext from mytable) as tmp;
}}}
For tables with a lot of features that is really slow, regardless of how many features are in the area of the actual output tile.

The call comes from `feature_style_processor::apply_to_layer()` where `layer::envelope()` is called. Since this envelope is only used when reprojecting the layer bounds (to clip the map extent to the layer extent), we can skip it for cases where the map projection == layer projection.

The patch adds:
* `==` and `!=` operators for `projection` (testing `projection::params`)
* skipping calculating a clipped layer extent where no reprojection is happening