Skip to content

Make __id__ column optional (it's required now) #217

Open

Description

@pnorman

When I try to serve data without an __id__ column I get the error

192.168.1.2 - - [09/Jun/2017 21:10:14] "GET /all/0/0/0.json HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/pnorman/osm/tilezen/tileserver/tileserver/__init__.py", line 148, in __call__
    response = self.handle_request(request)
  File "/home/pnorman/osm/tilezen/tileserver/tileserver/__init__.py", line 232, in handle_request
    self.post_process_data,
  File "/home/pnorman/osm/tilezen/tileserver/env/lib/python2.7/site-packages/tilequeue/process.py", line 243, in process_coord_no_format
    feature_id = row.pop('__id__')
KeyError: '__id__'

To get around this I added the column 0::bigint AS __id__, but I shouldn't need to do this. Not all data sources have meaningful IDs, or you might not want to include them in the output.

My queries file is

all:
  - water
layers:
  water:
    template: water.jinja2
    start_zoom: 0
    geometry_types: [Polygon]

and water.jinja2 is

SELECT
    {% filter geometry %}{{ bounds['polygon']|bbox_padded_intersection('way') }}{% endfilter %} AS __geometry__,
    0::bigint AS __id__
  FROM ne_ocean
  WHERE {{ bounds['polygon']|bbox_filter('way',3857) }}

Activity

  1. nvkelso commented on Jun 10, 2017

    @nvkelso
    Member
  2. changed the title [-]__id__ column required[/-] [+]Make __id__ column optional (it's required now)[/+] on Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions