Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4788 closed enhancement (fixed)

ST_SquareGrid (and others) don't support points on input

Reported by: tobwen Owned by: pramsey
Priority: medium Milestone: PostGIS 3.1.0
Component: postgis Version: master
Keywords: Cc:

Description

current situation

Currently, ST_SquareGrid (and similar functions) only supports polygons as input. When using points, there's neither any output nor a warning.

suggestion

In many cases, it's useful to generate a grid, which is based on a point.

current workaround

Buffer the point a little bit.

 SELECT * FROM ST_SquareGrid(1E1, ST_Buffer(ST_SetSRID(ST_MakePoint(12345, 54321), 3857), 1E-11));

Change History (5)

comment:1 by pramsey, 4 years ago

Version: 3.0.xmaster

comment:2 by pramsey, 4 years ago

ST_Expand is a more efficient workaround.

comment:3 by pramsey, 4 years ago

Resolution: wontfix
Status: newclosed

The input geometry is really just a bounds to fill. A point has no area in its bounds, so the function naturally returns nothing.

/* quick opt-out if we get nonsensical inputs  */
if (size <= 0.0 || gbounds_is_empty ||
    bounds_width <= 0.0 || bounds_height <= 0.0)
{
    funcctx = SRF_PERCALL_SETUP();
    SRF_RETURN_DONE(funcctx);
}

comment:4 by Paul Ramsey <pramsey@…>, 4 years ago

Resolution: wontfixfixed

In d1a410a/git:

Allows points to drive the generation of a single grid or square, closes #4788

comment:5 by Darafei Praliaskouski <me@…>, 4 years ago

In fa9e07d/git:

Remove unused variable

CI Fix
References #4788

Note: See TracTickets for help on using tickets.