GIST索引

Ganos实现了GeomGrid和H3Grid两种地理网格类型的原生2D空间索引。

使用方法

--创建带GeomGrid字段的表
CREATE TABLE geomgrid_gist_test (
    id serial,
    code geomgrid
);

--插入geomgrid记录
INSERT INTO geomgrid_gist_test(code) VALUES('0102000F58182C0E'::GeomGrid);
INSERT INTO geomgrid_gist_test(code) VALUES('0102000F58182C0D'::GeomGrid);
INSERT INTO geomgrid_gist_test(code) VALUES('0102000F59163522'::GeomGrid);
INSERT INTO geomgrid_gist_test(code) VALUES('0102000F59163622'::GeomGrid);
INSERT INTO geomgrid_gist_test(code) VALUES('0102000F59163B22'::GeomGrid);

--在code字段创建GIST 2D空间索引
CREATE INDEX geomgrid_gist_test_idx on geomgrid_gist_test using gist (code);
--创建带H3Grid字段的表
CREATE TABLE h3grid_gist_test (
    id serial,
    code h3grid
);

--插入h3grid记录
INSERT INTO h3grid_gist_test(code) VALUES('010100FFFF846CD932AB08'::H3Grid);
INSERT INTO h3grid_gist_test(code) VALUES('010100FF7F366127CEA308'::H3Grid);
INSERT INTO h3grid_gist_test(code) VALUES('010100FF7F466C3B8EAA08'::H3Grid);
INSERT INTO h3grid_gist_test(code) VALUES('010100FFFF0C134D87A308'::H3Grid);
INSERT INTO h3grid_gist_test(code) VALUES('010100FF7FD95460EFA108'::H3Grid);

--在code字段创建GIST 2D空间索引
CREATE INDEX h3grid_gist_test_idx on h3grid_gist_test using gist (code);