Opened 9 years ago

Closed 8 years ago

#3059 closed enhancement (fixed)

Allow passing per-dimension parameters in ST_Expand

Reported by: strk Owned by: dbaston
Priority: medium Milestone: PostGIS 2.3.0
Component: postgis Version: master
Keywords: Cc:

Description

Allow ST_Expand to take one amount for each dimension:

ST_Expand(geometry, x float8, y float8, z float8, m float8);

The current function would keep using the same amount for all of them.

Change History (7)

comment:1 by strk, 9 years ago

Owner: changed from pramsey to strk
Status: newassigned
Version: 2.1.xtrunk

comment:2 by strk, 9 years ago

Milestone: PostGIS 2.2.0PostGIS Future

comment:3 by dbaston, 8 years ago

Milestone: PostGIS FuturePostGIS 2.3.0
Owner: changed from strk to dbaston
Status: assignednew

This seems like a nice way to improve hackish ST_DWithin queries on WGS84 geometries stored as geometry.

So, to find polygons within 1km of a point, you could do:

SELECT * FROM polygons
WHERE geom && ST_Expand('POINT (37 52)', 1000.0/69000, 1000.0/111111, 0.0)
AND ST_Distance_Sphere(geom, 'POINT (37 52)') < 1000

where 69000 m approximates 1 degree of longitude, and 111111 m approximates 1 degree of latitude (at 52 degrees N)

comment:4 by strk, 8 years ago

I'm so glad we have you on board Daniel :)

comment:5 by robe, 8 years ago

I'm so glad too you are on board Dan, but I must sold you for using ST_Distance_Sphere instead of ST_DistanceSphere. http://postgis.net/docs/manual-2.2/ST_DistanceSphere.html

I'm surprised strk didn't pick up on that since he's the pedantic one.

Version 0, edited 8 years ago by robe (next)

comment:6 by dbaston, 8 years ago

Thanks all, and sorry if I occasionally get nostalgic for a comfortable, well-aged function name from a simpler time.

comment:7 by dbaston, 8 years ago

Resolution: fixed
Status: newclosed

Committed to trunk at r14929 / r14930

Note: See TracTickets for help on using tickets.