Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error converting between Postgres and Rust types when using !zoom! token #49

Closed
pnorman opened this issue Jul 13, 2017 · 4 comments
Closed

Comments

@pnorman
Copy link

pnorman commented Jul 13, 2017

2017-07-13 05:28:50.514 ERROR Query: SELECT ST_Multi(ST_SimplifyPreserveTopology(ST_Multi(way),$6::FLOAT8/2)) AS way,"name","ref","class","brunnel" FROM (  SELECT
      way,
      name,
      ref,
      highway AS class,
      CASE
        WHEN bridge IS NOT NULL AND bridge <> 'no' THEN 'bridge'
        ELSE CASE WHEN tunnel IS NOT NULL and tunnel <> 'no' THEN 'tunnel' END
      END AS brunnel
    FROM planet_osm_roads
    WHERE way && ST_MakeEnvelope($1,$2,$3,$4,3857)
      AND (highway = 'motorway'
        OR highway = 'trunk' AND $5 >= 7
        OR highway = 'primary' AND $5 >= 8
        OR highway = 'secondary' AND $5 >= 9)
  ) AS _q
2017-07-13 05:28:50.514 ERROR Param types: [Bbox, Zoom, PixelWidth]
2017-07-13 05:28:50.514 ERROR Param values: [-20037508.342789248, -20037508.342789248, 20037508.342789248, 20037508.342789248, 0, 156543.033928041]

The layer in question is

[[tileset.layer]]
name = "transport"
geometry_field = "way"
geometry_type = "LINESTRING"
srid = 3857
buffer-size = 128
simplify = true
  [[tileset.layer.query]]
  minzoom = 0
  maxzoom = 10
  sql = """
  SELECT
      way,
      name,
      ref,
      highway AS class,
      CASE
        WHEN bridge IS NOT NULL AND bridge <> 'no' THEN 'bridge'
        ELSE CASE WHEN tunnel IS NOT NULL and tunnel <> 'no' THEN 'tunnel' END
      END AS brunnel
    FROM planet_osm_roads
    WHERE way && !bbox!
      AND (highway = 'motorway'
        OR highway = 'trunk' AND !zoom! >= 7
        OR highway = 'primary' AND !zoom! >= 8
        OR highway = 'secondary' AND !zoom! >= 9)
  """

If I remove the !zoom! tokens, it works.

@pka
Copy link
Member

pka commented Jul 13, 2017

Fixed in 9caebd7. This was a severe one. Can you build yourself or shall I make a bugfix release?

@pnorman
Copy link
Author

pnorman commented Jul 14, 2017

I could figure out how to build myself, but it would be worth a bugfix release for everyone else.

@pka
Copy link
Member

pka commented Jul 14, 2017

Packages are building...

@pka pka closed this as completed Jul 14, 2017
@wilhelmberg
Copy link

I came across a similar problem with current release 0.7.8.
No time for building latest source myself but I could work around it by using CAST:

case CAST(!zoom! as int)
  when 7 then BR_TYP IN (5001,5002) AND DRAWCLASS IN (11010, 11020, 11030, 11110, 13010)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants