Opened 15 years ago

Closed 15 years ago

#207 closed enhancement (fixed)

ST_Buffer with style options for partial buffer

Reported by: robe Owned by: strk
Priority: medium Milestone: PostGIS 1.5.0
Component: postgis Version: master
Keywords: Cc:

Description

This is to support partial buffers.

As of #r4198.

Requires postgis_upgrade.sql or segfaults are around the corner (old SQL signature points to a now changed C version now interpreting 3rd arg as cstring rather than numeric).

postgis_upgrade.sql in turn will fail due to those types… So you'll need to manually drop CREATE TYPE statements from it.

When that's all done, any old code using buffer() should still work fine, but in addition you should now be able to specify parameters as key=value pairs separated by space. Supported params:

endcap=round|flat|square join=round|mitre|bevel mitre_limit≤float> (only makes sense with join=mitre) quad_segs≤int>

Tests welcome. Comments on the naming are also welcome before I move on to automated testing and documentation.

Change History (11)

comment:1 by robe, 15 years ago

Strk, I noticed you are not using dollar quoting.

Since we will not have anything less than 8.2, we should try to use the $$ quoting syntax. Easier to read. So

CREATE OR REPLACE FUNCTION ST_buffer(geometry,float8,integer)

RETURNS geometry AS $$

SELECT _ST_Buffer($1, $2,

CAST('quad_segs='
CAST($3 AS text) as cstring))

$$

LANGUAGE 'SQL' IMMUTABLE STRICT;

comment:2 by robe, 15 years ago

Owner: changed from pramsey to strk

Forgot to put in code block also reassigned

CREATE OR REPLACE FUNCTION ST_buffer(geometry,float8,integer)

    RETURNS geometry AS $$

SELECT _ST_Buffer($1, $2,

    CAST('quad_segs='CAST($3 AS text) as cstring))

$$

    LANGUAGE 'SQL' IMMUTABLE STRICT;

comment:3 by robe, 15 years ago

Hmm let me tr again

CREATE OR REPLACE FUNCTION ST_buffer(geometry,float8,integer)
	RETURNS geometry
	AS $$ SELECT _ST_Buffer($1, $2,
		CAST('quad_segs=' || CAST($3 AS text) as cstring))
           $$
	LANGUAGE 'SQL' IMMUTABLE STRICT; 






comment:4 by mcayland, 15 years ago

Yes - strk, please convert to $$ quoting as it is much easier to work with. Do we need to update the style guide at http://trac.osgeo.org/postgis/browser/trunk/STYLE to reflect this? It seems reasonably obvious looking at the rest of the file…

ATB,

Mark.

comment:5 by strk, 15 years ago

r4199 uses $$ quoting.

comment:6 by mcayland, 15 years ago

Looks good to me on a quick visual inspection; thanks strk. I'll let robe test before we close this…

ATB,

Mark.

comment:7 by mcayland, 15 years ago

Actually I've just noticed that you forgot to update the uninstall script:

postgis/uninstall_postgis.sql.in.c

Could you add the relevant DROP FUNCTION statements to this file as well please?

ATB,

Mark.

comment:8 by strk, 15 years ago

Done in r4207.

comment:9 by strk, 15 years ago

Can this be closed now Robe ?

comment:10 by robe, 15 years ago

Not sure. That is one thing I didn't touch since I've been so busy with 1.4 haven't really moved on too compiling 1.5. So I suspect this can not be closed.

comment:11 by robe, 15 years ago

Resolution: fixed
Status: newclosed

Ah never mind I misread this. Yah this is all done.

Note: See TracTickets for help on using tickets.