npx skills add https://github.com/postgis/postgis --skill postgis-skill--。st_segmentize -> ST_Segmentize)。geom;地理列命名为 geog。including 子句中添加值以加快查找速度是有意义的。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
drop table if exists + create table as;添加一些注释以帮助人们更快地理解查询。select postgis_full_version(); 以查看所有升级是否成功完成。sum(case when A then 1 else 0 end) 其实就是 count() filter (where A)row_number() ... = 1 很可能可以重写为 order by + limit 1(可能结合 distinct on 或 lateral)exists(select 1 from ...) 其实就是 exists(select from ...)tags ->> 'key' = 'value' 其实就是 tags @> '{"key": "value"}' - 对索引来说速度更快order by 子句也能保持顺序geometry(multilinestring, 4326))——使用普通的 geometry 或 geography 代替。这样可以避免 ST_Multi 的混乱和 ST_SetSRID 导致的错误。ST_UnaryUnion(ST_Collect(geom)) 其实就是 ST_Union(geom)ST_Buffer(geom, 0) 应该是 ST_MakeValid(geom)select min(ST_Distance(..)) 应该是 select ST_Distance() ... order by a <-> b limit 1 以启用 KNN GIST 索引order by ST_Distance(c.geog, t.geog) 应该是 order by c.geog <-> t.geogST_UnaryUnion 是一个信号,表明你可能做错了什么ST_MakeValid 是一个信号,表明你在上一步可能做错了什么ST_SetSRID 时要格外注意:检查输入数据的实际投影,检查是否可以在输入时正确设置(ST_GeomFromGeoJSON、EWKT 风格的 SRID=4326;POINT(...、EWKB 允许这样做)。检查是否需要改用 ST_Transform。ST_Intersects 而不是其他拓扑谓词。ST_Simplify(geom, 0) 可能是有意义的。ST_ClusterKMeans,k=2,并将 max_radius 设置为你的距离。ST_AsEWKB 进行二进制表示,而不是 ST_AsWKB,以保留 SRID。ST_Transform 到该坐标系之前,对 2D CRS 数据使用 ST_Force3DZ。ST_Hexagon / ST_HexagonGrid,改用 h3 扩展。ST_QuantizeCoordinates。每周安装量
84
代码仓库
GitHub 星标数
2.1K
首次出现
2026年1月25日
安全审计
安装于
codex77
opencode76
gemini-cli72
github-copilot72
cursor70
kimi-cli68
-- in front of it.st_segmentize -> ST_Segmentize).geom; geography column geog.including on same index for faster lookup.select postgis_full_version(); to see if all upgrades happened successfully.sum(case when A then 1 else 0 end) is just count() filter (where A)row_number() ... = 1 can likely be redone as order by + limit 1 (possibly with distinct on or lateral)exists(select 1 from ...) is just exists(select from ...)tags ->> 'key' = 'value' is just tags @> '{"key": "value"} - works faster for indexesgeometry(multilinestring, 4326)) - use plain geometry or geography instead. This removes clutter of ST_Multi and errors via ST_SetSRID.ST_UnaryUnion(ST_Collect(geom)) is just ST_Union(geom)ST_Buffer(geom, 0) should be ST_MakeValid(geom)select min(ST_Distance(..)) should be to enable knn gistWeekly Installs
84
Repository
GitHub Stars
2.1K
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex77
opencode76
gemini-cli72
github-copilot72
cursor70
kimi-cli68
代码安全审查清单:最佳实践与漏洞防范指南(含密钥管理、SQL注入防护)
1,700 周安装
order byselect ST_Distance() ... order by a <-> b limit 1order by ST_Distance(c.geog, t.geog) should be order by c.geog <-> t.geogST_UnaryUnion is a sign you're doing something wrongST_MakeValid is a sign you're doing something wrong on the previous stepST_SetSRID: check the actual projection of input data, check if it can be set correctly during input (ST_GeomFromGeoJSON, EWKT-style SRID=4326;POINT(..., EWKB allow that). Check if ST_Transform is needed instead.ST_Intersects to other topology predicatesST_Simplify(geom, 0)ST_ClusterKMeans with k=2 and max_radius set to your distance.ST_AsEWKB for binary representation instead of ST_AsWKB to keep SRID.ST_Hexagon / ST_HexagonGrid use h3 extension.ST_QuantizeCoordinates if precision is known.