[postgis-users] Converting WKT or WKB

Abe Gillespie agillesp at vt.edu
Sun Feb 6 10:37:30 PST 2005


Hello all.  I'm new to the list.

I've just started using PostGIS, I'm one from the MapServer crowd.  I'd 
like to use PostGIS with some ESRI technologies and am hoping to find 
an easy way to go from PostGIS objects to ESRI objects.

My first idea is using Postgres native geometry types.  The .Net data 
connector (Npgsql) has support for these built in types.  Are there any 
PostGIS functions that will convert its types to Postgres geometry 
types?  I imagine things working sort of like:

string sql = "SELECT as_native_postgres_box(extent(the_geom)) FROM 
shape_table";
NpgsqlCommand cmd = new NpgsqlCommand(sql, con);
NpgsqlBox box = (NpgsqlBox)cmd.ExecuteScalar();

The second idea is to just use a third party library to do the parsing 
for me.  I see there's a java one, but I'm looking for a .Net happy 
library.

Also, and this is OT from the subject, but how do you specify to 
PostGIS whether the geometries are stored as WKT or WKB?  Mine are all 
WKT and I'm curious in case down the road I want to use WKB.

Thanks for any help.
-Abe




More information about the postgis-users mailing list