From: Sandro Santilli Date: Fri, 20 Aug 2004 16:36:22 +0000 (+0000) Subject: transform() support X-Git-Tag: pgis_0_9_1~79 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfc1181cf1875aed0565918603ce25bfde485048;p=postgis transform() support git-svn-id: http://svn.osgeo.org/postgis/trunk@715 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/lwgeom/lwpostgis.sql.in b/lwgeom/lwpostgis.sql.in index 270856cbc..bb7d90332 100644 --- a/lwgeom/lwpostgis.sql.in +++ b/lwgeom/lwpostgis.sql.in @@ -11,6 +11,9 @@ -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- $Log$ +-- Revision 1.5 2004/08/20 16:36:22 strk +-- transform() support +-- -- Revision 1.4 2004/08/20 14:54:35 strk -- gist operators support functions renamed to allow for finer control by postgis_restore.pl -- @@ -954,13 +957,6 @@ CREATE TABLE geometry_columns ( f_table_name, f_geometry_column ) ); ------------------------------------------------------------------------ --- GET_PROJ4_FROM_SRID( ) ------------------------------------------------------------------------ -CREATEFUNCTION get_proj4_from_srid(integer) RETURNS text AS -'SELECT proj4text::text FROM spatial_ref_sys WHERE srid= $1' -LANGUAGE 'sql' WITH (iscachable,isstrict); - ----------------------------------------------------------------------- -- RENAME_GEOMETRY_TABLE_CONSTRAINTS() ----------------------------------------------------------------------- @@ -1765,7 +1761,29 @@ END; LANGUAGE 'plpgsql' WITH (iscachable); +--------------------------------------------------------------- +-- PROJ support +--------------------------------------------------------------- + +CREATEFUNCTION get_proj4_from_srid(integer) RETURNS text AS +'SELECT proj4text::text FROM spatial_ref_sys WHERE srid= $1' +LANGUAGE 'sql' WITH (iscachable,isstrict); + +CREATEFUNCTION transform_geometry(geometry,text,text,int) + RETURNS geometry + AS '@MODULE_FILENAME@','transform_geom' + LANGUAGE 'C' WITH (isstrict,iscachable); + +CREATEFUNCTION transform(geometry,integer) RETURNS geometry AS +'BEGIN + RETURN transform_geometry( $1 , get_proj4_from_srid(SRID( $1 ) ), get_proj4_from_srid( $2 ), $2 ); + END;' +LANGUAGE 'plpgsql' WITH (iscachable,isstrict); + +--------------------------------------------------------------- +-- END +--------------------------------------------------------------- COMMIT;