生成postgis 网格的方法
蜂窝结果的Grid图:
SELECT translate(the_geom, x_series, y_series)
from generate_series(0 – 128, 10000 + 128, 128) as x_series,
generate_series(0 – 128, 10000 + 128, 256) as y_series,
(
SELECT ‘POLYGON((0 0,64 64,64 128,0 192,-64 128,-64 64,0 0))’::geometry as the_geom
UNION
SELECT translate(‘POLYGON((0 0,64 64,64 128,0 192,-64 128,-64 64,0 0))’::geometry, 64, 128) as the_geom
) as one_hex
正方形的图:
create table squ_grid (gid serial not null primary key, the_geom geometry not null);
INSERT INTO squ_grid (the_geom)
SELECT translate(the_geom, x_series, y_series)
from generate_series(0 – 128, 10000 + 128, 128) as x_series,
generate_series(0 – 128, 10000 + 128, 256) as y_series,
(
SELECT geomFromText(‘POLYGON((0 0,0 64,64 64,64 0,0 0))’,900913)::geometry as the_geom
) as one_hex;
转载自:https://blog.csdn.net/iteye_15840/article/details/81677424