mirror of
https://github.com/maplibre/martin.git
synced 2024-12-18 20:31:54 +03:00
fix: handle tables with no properties
This commit is contained in:
parent
241dda3184
commit
d6aee81b1b
@ -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
|
@ -41,12 +41,17 @@ impl Source {
|
||||
)
|
||||
};
|
||||
|
||||
let columns: Vec<String> = 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::<Vec<String>>()
|
||||
.join(",");
|
||||
|
||||
let properties = columns.join(",");
|
||||
format!(", {0}", properties)
|
||||
};
|
||||
|
||||
let query = format!(
|
||||
include_str!("scripts/get_tile.sql"),
|
||||
|
Loading…
Reference in New Issue
Block a user