Skip to content

Commit

Permalink
added coalesce to avoid issue when property does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
aagm committed Sep 20, 2023
1 parent 397b6de commit bdb5140
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class FeatureService {
const { z, x, y, id } = tileSpecification;
const simplificationLevel = 360/(Math.pow(2, z+1)*100);
const attributes = 'feature_id, properties';
const table = `(select ST_RemoveRepeatedPoints((st_dump(the_geom)).geom, ${simplificationLevel}) as the_geom, (properties || jsonb_build_object('amount', amount)) as properties, feature_id from "${this.featuresRepository.metadata.tableName}")`;
const table = `(select ST_RemoveRepeatedPoints((st_dump(the_geom)).geom, ${simplificationLevel}) as the_geom, (coalesce(properties,'{}'::jsonb) || jsonb_build_object('amount', amount)) as properties, feature_id from "${this.featuresRepository.metadata.tableName}")`;
const customQuery = this.buildFeaturesWhereQuery(id, bbox);
return this.tileService.getTile({
z,
Expand Down

0 comments on commit bdb5140

Please sign in to comment.