Message posté par : Nicolas Ribot
----------------------------------------
Bonjour,
Pour ces gestions de grilles régulières, j'utilise une fonction venant du forum
postgis users:
-----------------
Code :
-- AUTHOR : Mike Toews,
-- SYNOPSYS : Creates a polygonal grid with specified dimensions
-- IN : nrow: number of grid rows
-- : ncol: number of grid columns
-- : xsize: grid cell width
-- : ysize: grid cell height
-- : x0: x-origin of grid
-- : y0: y-origin of grid
--
-- OUT : row: int: row index
-- : col: int col index
-- : geom: geometry grid cell polygon
--
-- OUTCALL : Néant
--
-- USAGE : SELECT * from fn_createFishnet(100, 100, 1, 1, -180, -90)
-- : as (row int, col int, geom geometry)
--
-- : Code from Postgis User list:
-- :
http://trac.osgeo.org/postgis/wiki/UsersWikiCreateFishnet
CREATE OR REPLACE FUNCTION st_CreateFishnet(
nrow integer, ncol integer,
xsize float8, ysize float8,
x0 float8 DEFAULT 0, y0 float8 DEFAULT 0,
OUT "row" integer, OUT col integer,
OUT geom geometry)
RETURNS SETOF record AS
$$
SELECT
i + 1 AS row,
j + 1 AS col,
ST_Translate(cell, j * $3 + $5, i * $4 + $6) AS geom
FROM generate_series(0, $1 - 1) AS i,
generate_series(0, $2 - 1) AS j,
(
SELECT ('POLYGON((0 0, 0 ' || $4 || ', ' || $3 || ' ' || $4 ||
', ' || $3 || ' 0,0 0))') :: geometry AS cell
) AS foo;
$$
LANGUAGE sql
IMMUTABLE
STRICT;
-----------------
En donnant en paramètre le point de votre grille à partir duquel vous voulez étendre la
grille, plus les paramètres de la grille, vous devriez pouvoir étendre votre grille
----------------------------------------
Le message est situé
https://georezo.net/forum/viewtopic.php?pid=334190#p334190
Pour y répondre : geobd(a)ml.georezo.net ou reply de votre messagerie
Pour vous désabonner connectez-vous sur le forum puis Profil / Abonnement
--
Association GeoRezo - le portail géomatique
https://georezo.net