Created
September 21, 2016 18:18
-
-
Save zimmicz/828772137eff52835012a508c303a040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION ST_PolygonFromCentroid(centroid geometry, xsize numeric, ysize numeric) | |
RETURNS geometry | |
AS $ST_PolygonFromCentroid$ | |
SELECT ST_MakeEnvelope( | |
ST_X(ST_Translate($1, -$2, -$3)), | |
ST_Y(ST_Translate($1, -$2, -$3)), | |
ST_X(ST_Translate($1, $2, $3)), | |
ST_Y(ST_Translate($1, $2, $3)) | |
); | |
$ST_PolygonFromCentroid$ | |
LANGUAGE SQL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment