[postgis-devel] Transform() PROJ4 cache patch

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Tue Nov 1 04:06:03 PST 2005


> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net 
> [mailto:postgis-devel-bounces at postgis.refractions.net] On 
> Behalf Of strk at refractions.net
> Sent: 01 November 2005 10:40
> To: 'PostGIS Development Discussion'
> Subject: Re: [postgis-devel] Transform() PROJ4 cache patch
> 
> 
> Great work Mark.
> 
> I tested your code against 7.2.1, but it doesn't compile:
> 
> gcc -DUSE_VERSION=72 -DPOSTGIS_LIB_VERSION='"1.1.0CVS"' 
> -DPOSTGIS_SCRIPTS_VERSION='"0.3.1"' 
> -DPOSTGIS_BUILD_DATE='"2005-11-01 10:37:45"' 
> -I/usr/home/strk/extra/proj-4.4.5//include -DUSE_PROJ  
> -I/pgroot-7.2.1/include/postgresql/server -DAUTOCACHE_BBOX=1  
> -DUSE_STATS -Wall -g -O2 -fPIC -fexceptions -DUSE_GEOS    -c 
> -o lwgeom_transform.o lwgeom_transform.c
> lwgeom_transform.c:84: warning: excess elements in struct initializer
> lwgeom_transform.c:84: warning: (near initialization for 
> `PROJ4SRSCacheContextMethods')
> lwgeom_transform.c:89: warning: excess elements in struct initializer
> lwgeom_transform.c:89: warning: (near initialization for 
> `PROJ4SRSCacheContextMethods')
> lwgeom_transform.c: In function `AddToPROJ4SRSCache':
> lwgeom_transform.c:196: warning: implicit declaration of 
> function `SPI_execute'
> lwgeom_transform.c: In function `transform':
> lwgeom_transform.c:493: `MessageContext' undeclared (first 
> use in this function)
> lwgeom_transform.c:493: (Each undeclared identifier is 
> reported only once
> lwgeom_transform.c:493: for each function it appears in.)
> 
> 
> --strk;


Hi strk,

Thanks for testing - I haven't had a chance to do much more work on it, but
should find some time later this week. The peformance here is great - under
6s to reproject over 425k points :). Browsing the PostgreSQL source, some
good inspiration can be found in contrib/dblink which uses a cache to store
its database connections - it stashes it's connections in TopMemoryContext
as opposed to MessageContext. I shall enable debugging and have a play with
TopMemoryContext to see if it gets created/destroyed in the right places....

As for the different versions, I was already thinking of moving the
cache-specific code into a new lwgeom_transform_cache.c and
lwgeom_transform_cache.h file, so I could then use some #ifs to set the
correct struct definition depending upon the current version.


Many thanks,

Mark.

------------------------
WebBased Ltd
17 Research Way
Plymouth
PL6 8BT

T: +44 (0)1752 797131
F: +44 (0)1752 791023

http://www.webbased.co.uk   
http://www.infomapper.com 
http://www.swtc.co.uk  

This email and any attachments are confidential to the intended recipient
and may also be privileged. If you are not the intended recipient please
delete it from your system and notify the sender. You should not copy it or
use it for any purpose nor disclose or distribute its contents to any other
person.





More information about the postgis-devel mailing list