[postgis-users] Failing hstore query

Paragon Corporation lr at pcorp.us
Sat Dec 20 09:32:51 PST 2014


Looks fine to me. Which brings me to couple of troubleshooting questions:

1) Have you tried running mapnik query? To confirm it is including maritime
boundaries -- I don't see how it could be.  



SELECT ST_AsBinary("way") AS geom,"admin_level" FROM ( SELECT way,
admin_level
          FROM eur_line
          WHERE boundary = 'administrative'
            AND admin_level = '2'
            AND NOT tags @> '"maritime"=>"yes"'::hstore
        ) AS data WHERE "way" && ST_SetSRID('BOX3D(-939258.2035682483
6574807.42
4977713,313086.0678560843 7827151.69640205)'::box3d, 3857)

2) Are you sure that is the query it is running or are you just guessing
based on how you know things are put together?  If you are just guessing, I
would enable logging on your database to confirm that is the query

Something like:
ALTER DATABASE your_database SET log_statement = 'all';


3) Is it possible your maritime border is being drawn by another layer
query?

Hope that helps,
Regina
http://www.postgis.us
http://postgis.net
 

-----Original Message-----
From: postgis-users-bounces at lists.osgeo.org
[mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Zenon Panoussis
Sent: Saturday, December 20, 2014 10:58 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Failing hstore query


I'm rendering OSM tiles with mapnik and I want to get rid of maritime
borders, so I added the "AND NOT" statement to the
style:

<Parameter name="table"><![CDATA[( SELECT way, admin_level
  FROM eur_line
  WHERE boundary = 'administrative'
    AND admin_level = '2'
    AND NOT tags @> '"maritime"=>"yes"'::hstore
) AS data]]></Parameter>

Manually executing the query inside the parenthesis as-is works exactly as
expected. The data (osm_id, tags) can look like this:

46419225 | "name:en"=>"Portugal, Azores, Flores and Corvo (territorial
waters)", "name:fr"=>"Portugal, Açores, Flores et Corvo (eaux
territoriales)", "name:pt"=>"Portugal, Açores, Flores e Corvo (águas
territoriais)", "maritime"=>"yes", "border_type"=>"territorial"

Mapnik's full query based on the above style looks like
this:

SELECT ST_AsBinary("way") AS geom,"admin_level" FROM ( SELECT way,
admin_level
          FROM eur_line
          WHERE boundary = 'administrative'
            AND admin_level = '2'
            AND NOT tags @> '"maritime"=>"yes"'::hstore
        ) AS data WHERE "way" && ST_SetSRID('BOX3D(-939258.2035682483
6574807.42
4977713,313086.0678560843 7827151.69640205)'::box3d, 3857)

The end result is that all maritime borders which do have the
"maritime"=>"yes" tag are still rendered. And for my life I just can't grasp
how the outer SELECT can ever see maritime borders when the inner SELECT is
supposed to have excluded them.

Can anyone see what I'm doing wrong here and help me regain my sanity?

Z

_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users




More information about the postgis-users mailing list