go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.29k stars 197 forks source link

Error on layer without feature IDs #126

Closed pnorman closed 7 years ago

pnorman commented 7 years ago

I have a layer without feature IDs. When I give it the definition

[[providers.layers]]
  name = "ocean"
  geometry_fieldname = "way"
  sql = "SELECT ST_AsBinary(way) AS way FROM ne_ocean WHERE way && !BBOX!"

I get the error 2017/05/31 12:12:49 SQL for layer(0) ocean does not contain the id field for the geometry: gid

There is no field for this table that could be used as an ID.

ARolek commented 7 years ago

@pnorman I just checked the spec and you're use case is perfectly valid. From the Feature section

A feature MAY contain an id field. If a feature has an id field, the value of the id SHOULD be unique among the features of the parent layer.

I will look into a fix for this. Thanks for the report.

ARolek commented 7 years ago

@pnorman do you have a simple test dataset you can share? I'm going to build a test case around this so we can get it addressed.

pnorman commented 7 years ago

Where I ran into this is natural earth and ocean shapefiles loaded with https://github.com/kartotherian/meddo/blob/master/get-external-data.py, but you should be able to replicate it with any dataset if you don't include a column for ID.