<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">


<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>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?</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Thank you,</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Jason Sardano</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>//Sample </span></font><font size=2 face=Arial><span
  style='font-size:10.0pt;font-family:Arial'>ADO</span></font><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'> Code:</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>ipRecordset->AddNew();</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>//…</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>ipRecordset->put_Collect(CComVariant(shapeFieldName), CComVariant(ShapeToWKT(ipGeometry,
-1))); //ShapeToWKT returns a BSTR</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>//…</span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>ipRecordset->Update(); //the geometry is saved if it is a
valid length, otherwise a NULL geometry is stored.</span></font></p>

</div>

</body>

</html>