On Mon, Jan 26, 2015 at 08:37:41AM -0800, Max Demars wrote:
> Hi Sandro,
> I am using Mapnik 2.2.0 and with the query below I got the error g column
> does not exists. Is is because there is an error in my query or because
> this version does not support such operation?
I think there's still a bug in Mapnik that fails to extract an extent
from a subquery. Try adding an "extent" parameter. If it works please
check whether such bug was filed already or file it yourself otherwise.
Thanks!
As for the indexes, the problem is that Mapnik will append:
WHERE g && <the_map_extent>
to the query, but as "g" is a derivate column it is unlikely to
have an index defined on.
You can define an index on it:
CREATE INDEX on layer_features using gist (
coalesce(geom_multipoint, geom_multilinestring, geom_multipolygon)
):
Or, you can use the !bbox! token in your query so that Mapnik will know
you embedded the filter yourself in the query:
<Parameter name="table">
(SELECT shapefile_id,
coalesce(geom_multipoint, geom_multilinestring, geom_multipolygon) g
FROM layers_feature
WHERE shapefile_id in (28,29)
AND (
geom_multipoint && !bbox!
OR geom_multilinestring && !bbox!
OR geom_multipolygon && !bbox!
)
) as geom
</Parameter>