[postgis-users] FW: [Psycopg] RELEASE: GeoTypes-0.2.0a1

David Blasby dblasby at refractions.net
Wed Sep 24 17:43:13 PDT 2003


>>2) All the OpenGIS types (there are seven of them) have the same type oid. 
>>They are implemented as subclasses of the same (GEOMETRY) base class. To deal 
>>with this I have registered a factory class against the type oid and the 
>>factory class works out, from the string returned by the database, which 
>>subclass to create. This looked like a reasonable design to me, does anyone 
>>have any other suggestions?

Yes - this is probably the best thing to do.  The OGC function 
GetGeometryType() basically tells you what type the actual geometry is. 
  So, a MULTIPOLYGON returns "MULTIPOLYGON".

Also, I suggest you plan for using WKB instead of WKT because its much 
more efficient (space wise), easier to parse, and you dont lose any 
precision in your coordinates.

>>3) Because the Geometry type is added to postgres on a database by database 
>>basis its type oid is different for each database. I dynamically work out 
>>what the type oid is by creating a table with a Geometry field and querying 
>>the oid of that field. I have a feeling that I should be able to get the type 
>>oid without creating the table. Does anyone know how to do this?

SELECT oid from pg_type where typname = ''geometry'' ;


dave




More information about the postgis-users mailing list