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

Empty value stops processing of layer data #429

Closed
tomass opened this issue Jun 9, 2018 · 5 comments
Closed

Empty value stops processing of layer data #429

tomass opened this issue Jun 9, 2018 · 5 comments
Labels
Milestone

Comments

@tomass
Copy link

tomass commented Jun 9, 2018

It is useful to add some casing to polygon geometries (for example to water features). But as OpenStreetMap water polygons are made of parts (for various reasons), it could give unwanted artefacts as can be seen in this example where smaller river flows into the larger one:
paveikslas
The usual solution is to aggregate geometries with st_union when creating vector tile (aggregating water geometries beforehand for whole region could create huge geometries so it is not a good solution). For example:

select
  gid,
  st_union(geom) AS geom
from
  planet_osm_polygon
where
  geom && !BBOX!

When a tile has no geometries in a BBOX, this produces a null value for geom (because st_union is an aggregate function). Such null value stops Tegola processing of layer data with following output to console:

2018/06/09 22:15:25 map.go:193: err fetching tile (z: 10, x: 584, y: 323) features: unable to decode layer (water10) geometry field (geom) into wkb where (gid = 1): EOF

Now this would not be a problem (if we ignore error message), but if there is another part in a query:

select ... st_union(geom) AS geom ...
union all
select somethingelse AS geom from sometable

then geometries of the second part of such query are not placed into the vector tile basically leaving layer empty in particular tile.
I guess Tegola should handle such null values as "no geometry" and continue with processing query results.

@ARolek
Copy link
Member

ARolek commented Jun 11, 2018

@tomass thanks for the detailed report. I think your proposed solution should work fine. I will add it to our roadmap.

@ARolek
Copy link
Member

ARolek commented Jul 6, 2018

This has been addressed in the v0.7.0 branch.

@ARolek ARolek closed this as completed Jul 6, 2018
@tomass
Copy link
Author

tomass commented Mar 20, 2019

Can you reopen this one or should I create a new issue as originally I did not mention usage of st_intersection which is causing "second part" of this problem?
(more info here: #430)

@ARolek
Copy link
Member

ARolek commented Mar 20, 2019

@tomass re-opening.

@ARolek ARolek reopened this Mar 20, 2019
ARolek added a commit that referenced this issue Apr 5, 2019
Added back geometry collection length check to ignore
0 length geometry collections. Added associated test case.

closes #429
ARolek added a commit that referenced this issue Apr 6, 2019
Added back geometry collection length check to ignore
0 length geometry collections. Added associated test case.

closes #429
ARolek added a commit that referenced this issue Apr 9, 2019
Added back geometry collection length check to ignore
0 length geometry collections. Added associated test case.

closes #429
ARolek added a commit that referenced this issue Apr 9, 2019
* moved empty geometry collection check to the atlas package so all providers can benefit.
* Added test case to atlas for empty geometry collection
Reworked the TestEncode function to match the new testing convention.
* added emptycollection test provider

closes #429
@ARolek
Copy link
Member

ARolek commented Apr 9, 2019

This fix has been merged into v0.9.x branch. I'm working on cutting a release soon.

@ARolek ARolek closed this as completed Apr 9, 2019
ARolek added a commit that referenced this issue Apr 9, 2019
* moved empty geometry collection check to the atlas package so all providers can benefit.
* Added test case to atlas for empty geometry collection
Reworked the TestEncode function to match the new testing convention.
* added emptycollection test provider

closes #429
ARolek added a commit that referenced this issue Apr 9, 2019
* moved empty geometry collection check to the atlas package so all providers can benefit.
* Added test case to atlas for empty geometry collection
Reworked the TestEncode function to match the new testing convention.
* added emptycollection test provider

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

No branches or pull requests

2 participants