artemp/trac2github — Issue #549: Layer query bbox not correct on Lambert Map
Author: artemp
Created: 2011-10-09 20:39:59+00:00
State: closed
Labels: Core_Library

I've got layers in PostGIS in latlong, some of them are the entire world, e.g. -180,-90,180,90

When making a map in Lambert conformal conic (and probably all other conical projections), the logic for intersecting envelopes and calculating layer bbox isn't quite right.

Currently, feature_style_processor.hpp converts the layer extents into the map projection before comparing. If you convert -180,-90 to lambert it's usually above the north pole, the resulting bbox is non-sensical. (see http://www.mgaqua.net/AquaDoc/Projections/img/Lambert%20Conformal%20Conic.jpg)

This patch reverses things a bit, and converts the map extents into the layer's projection, then compares and clips. It's actually faster because you end up doing 2 fewer projection transforms.

It's not perfect, but works well for well-centered conical maps.

Forgive me if my patch doesn't work, this is my first time doing something like this.