diff --git a/src/scripts/get_tile.sql b/src/scripts/get_tile.sql index 350c7516..99a317de 100755 --- a/src/scripts/get_tile.sql +++ b/src/scripts/get_tile.sql @@ -1,14 +1,7 @@ WITH bounds AS (SELECT {mercator_bounds} as mercator, {original_bounds} as original) SELECT ST_AsMVT(tile, '{id}', {extent}, 'geom') FROM ( SELECT - ST_AsMVTGeom( - {geometry_column_mercator}, - bounds.mercator, - {extent}, - {buffer}, - {clip_geom} - ) AS geom, - {properties} + ST_AsMVTGeom({geometry_column_mercator}, bounds.mercator, {extent}, {buffer}, {clip_geom}) AS geom {properties} FROM {id}, bounds WHERE {geometry_column} && bounds.original {condition} ) AS tile WHERE geom IS NOT NULL \ No newline at end of file diff --git a/src/source.rs b/src/source.rs index 8910b452..869f9b5e 100755 --- a/src/source.rs +++ b/src/source.rs @@ -41,12 +41,17 @@ impl Source { ) }; - let columns: Vec = self.properties - .keys() - .map(|column| format!("\"{0}\"", column)) - .collect(); + let properties = if self.properties.is_empty() { + "".to_string() + } else { + let properties = self.properties + .keys() + .map(|column| format!("\"{0}\"", column)) + .collect::>() + .join(","); - let properties = columns.join(","); + format!(", {0}", properties) + }; let query = format!( include_str!("scripts/get_tile.sql"),