[postgis-users] ST_AsMVTGeom buffer not working as I expected

James McManus jmpmcmanus at gmail.com
Tue Sep 22 13:22:26 PDT 2020


I'm using ST_AsMVTGeom in a function, to extract map box tiles, from a
database, which consist of lat/lon points that I then render as Voronoi
polygons. However, the ST_AsMVTGeom buffer does not appear to be working,
because the Voronoi polygons are not connected between tiles. I'm using
PostGIS 3.0, on PostgreSQL 11. Below is the function:

CREATE OR REPLACE
-- 
http://localhost:7800/public.region3_sim_storms_geom/13/2362/3138.pbf?properties=node,bathymetry
FUNCTION public.region3_sim_storms_geom(z integer, x integer, y integer)
RETURNS bytea
AS $$
  WITH
  bounds AS (
    SELECT ST_TileEnvelope(z, x, y) AS geometry
  ),
  mvtgeom AS (
    SELECT ST_AsMVTGeom(ST_Transform(geom, 3857), bounds.geometry, 4096,
256, true) AS geom, node, bathymetry
    FROM r3sim_fort_geom, bounds
    WHERE ST_Intersects(geom, ST_Transform(bounds.geometry, 4326))
  )
  SELECT ST_AsMVT(mvtgeom.*, 'public.region3_sim_storms_geom')
  FROM mvtgeom;
$$
LANGUAGE 'sql'
STABLE
PARALLEL SAFE;

COMMENT ON FUNCTION public.region3_sim_storms_geom IS 'Given a tile address
query database.';

I've tried many variations, using the default settings, and inputting
settings.

I have been able to display the same data as Voronoi polygons, without the
tile connection problem using pg_tileserv
<https://github.com/CrunchyData/pg_tileserv>.

Thanks
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200922/df1594ad/attachment.html>


More information about the postgis-users mailing list