Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 使用POSTGIS生成MVT,并在不同的缩放级别排除某些几何图形_Sql_Python 3.x_Postgresql_Postgis_Geodjango - Fatal编程技术网

Sql 使用POSTGIS生成MVT,并在不同的缩放级别排除某些几何图形

Sql 使用POSTGIS生成MVT,并在不同的缩放级别排除某些几何图形,sql,python-3.x,postgresql,postgis,geodjango,Sql,Python 3.x,Postgresql,Postgis,Geodjango,我有一个数据库,它有三个几何表格“tbl_点,tbl_线,tbl_多边形”,有数百万个特征 对于几何图形和多几何图形,每个表都有两个分别名为geom和m_geom的几何图形列 我正在使用POSTGIS和以下查询生成MVT WITH bounds AS (SELECT ST_Segmentize(ST_MakeEnvelope(8247861.100083642, 3546678.1124321707, 8252753.069893893, 3551570.082242422

我有一个数据库,它有三个几何表格“tbl_点,tbl_线,tbl_多边形”,有数百万个特征

对于几何图形和多几何图形,每个表都有两个分别名为geom和m_geom的几何图形列

我正在使用POSTGIS和以下查询生成MVT

WITH 
   bounds AS (SELECT ST_Segmentize(ST_MakeEnvelope(8247861.100083642, 3546678.1124321707, 
      8252753.069893893, 3551570.082242422, 3857),1222.9924525627866) AS geom, 
      ST_Segmentize(ST_MakeEnvelope(8247861.100083642, 3546678.1124321707, 8252753.069893893, 
                    3551570.082242422, 3857),1222.9924525627866)::box2d AS b2d
     ), 
  f_300 AS (SELECT ST_Simplify(ST_AsMVTGeom(ST_Transform(t.geom, 3857), bounds.b2d, 4096, 128, true), 20) 
            AS geom, t.id FROM tbl_line t, bounds 
            WHERE ST_Intersects(t.geom, ST_Transform(bounds.geom, 4326)) 
            AND t.shp_id = 300 AND t.deleted = FALSE
            UNION
            SELECT ST_Simplify(ST_AsMVTGeom(ST_Transform(t.m_geom, 3857), bounds.b2d, 4096, 128, true), 20) 
            AS geom, t.id FROM tbl_line t, bounds
            WHERE ST_Intersects(t.m_geom, ST_Transform(bounds.geom, 4326)) 
            AND t.shp_id = 300 AND t.deleted = FALSE
           ), 
 f_299 AS (
           ......
           AS geom, t.id FROM tbl_point t, bounds 
           ......
          ), 
f_307 AS ( ......
           AS geom, t.id FROM tbl_polygon t, bounds 
           ......
         )
                 
SELECT ST_AsMVT(f_300.*, '300') FROM f_300
UNION 
SELECT ST_AsMVT(f_299.*, '299') FROM f_299
UNION 
SELECT ST_AsMVT(f_307.*, '307') FROM f_307
如何在不同的缩放级别排除某些功能以避免拥塞

此外,任何关于改进查询的建议都被高度推崇