[postgis-users] Inserting geometry using ADO...

strk at refractions.net strk at refractions.net
Tue Nov 9 10:36:31 PST 2004


On Tue, Nov 09, 2004 at 12:43:27PM -0500, Jason Sardano wrote:
> I am writing an extension for ESRI's ArcCatalog that will allow a user to
> export feature classes to PostGIS. The spatial data is exported as WKT to
> PostGIS correctly if and only if the WKT length is less than or equal to the
> max varchar size attribute of my connection and the geometry column's length
> (the OLE DB driver from Postgresql sees the geometry as text). If I change
> the max varchar size property on my connection string to a valid size for
> the geometry (greater than 8190), I receive a message box stating "can't
> alloc Desc Handle yet"; so simply changing the max varchar size is not a
> solution. I also receive an error if I try a raw sql update of the geometry.
> Is there a better way to insert spatial data into PostGIS from an OLEDB/ODBC
> client?

I've no experience with OLEDB/ODBC, but postgis supports binary input
in WKB format.

--strk;


> 
>  
> 
> Thank you,
> 
> Jason Sardano
> 
>  
> 
> //Sample ADO Code:
> 
> ipRecordset->AddNew();
> 
> //.
> 
> ipRecordset->put_Collect(CComVariant(shapeFieldName),
> CComVariant(ShapeToWKT(ipGeometry, -1))); //ShapeToWKT returns a BSTR
> 
> //.
> 
> ipRecordset->Update(); //the geometry is saved if it is a valid length,
> otherwise a NULL geometry is stored.
> 

> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list