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)
|
WITH bounds AS (SELECT {mercator_bounds} as mercator, {original_bounds} as original)
|
||||||
SELECT ST_AsMVT(tile, '{id}', {extent}, 'geom') FROM (
|
SELECT ST_AsMVT(tile, '{id}', {extent}, 'geom') FROM (
|
||||||
SELECT
|
SELECT
|
||||||
ST_AsMVTGeom(
|
ST_AsMVTGeom({geometry_column_mercator}, bounds.mercator, {extent}, {buffer}, {clip_geom}) AS geom {properties}
|
||||||
{geometry_column_mercator},
|
|
||||||
bounds.mercator,
|
|
||||||
{extent},
|
|
||||||
{buffer},
|
|
||||||
{clip_geom}
|
|
||||||
) AS geom,
|
|
||||||
{properties}
|
|
||||||
FROM {id}, bounds
|
FROM {id}, bounds
|
||||||
WHERE {geometry_column} && bounds.original {condition}
|
WHERE {geometry_column} && bounds.original {condition}
|
||||||
) AS tile WHERE geom IS NOT NULL
|
) AS tile WHERE geom IS NOT NULL
|
@ -41,12 +41,17 @@ impl Source {
|
|||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
let columns: Vec<String> = self.properties
|
let properties = if self.properties.is_empty() {
|
||||||
.keys()
|
"".to_string()
|
||||||
.map(|column| format!("\"{0}\"", column))
|
} else {
|
||||||
.collect();
|
let properties = self.properties
|
||||||
|
.keys()
|
||||||
|
.map(|column| format!("\"{0}\"", column))
|
||||||
|
.collect::<Vec<String>>()
|
||||||
|
.join(",");
|
||||||
|
|
||||||
let properties = columns.join(",");
|
format!(", {0}", properties)
|
||||||
|
};
|
||||||
|
|
||||||
let query = format!(
|
let query = format!(
|
||||||
include_str!("scripts/get_tile.sql"),
|
include_str!("scripts/get_tile.sql"),
|
||||||
|
Loading…
Reference in New Issue
Block a user