John
Thanks for picking up the post. I think I have a vague idea of the
source of the problem but I don't really know why it might be
happening.
I had the conversion code inside a backgroundworker thread. I was
passing the IFeatureLayer to the backgroundworker thread.
Using the IFeatureLayer, I was able to read the feature class and the
geometry inside the featureclass but got the error when trying to
convert the ESRI geometry to OGC.
I have a suspicion that this might be due to IGeometryFactory or
GeometryEnvironment being out of scope inside the backgroundworker but
that could be all nonsense logic..
So, I basically moved the conversion out of the backgroundworker and
it appears to be working okay for now..
Sanjay
On Oct 17, 4:44 pm, GIS Geezer <
john.fan...@gis4business.co.uk> wrote:
> Sanjay
>
> I've used a version of this code recently to convert both from and to
> esri geometry with no problems. It sounds like it may be a problem
> with a specific geometry you are trying to convert. Have you checked
> the geometry is valid prior to converting to NTS? For example, are you
> testing for null geometry?
>
> One other thing to mention is that esri (especially sde) is quite
> fussy about having valid geometry - so if you are converting TO esri
> geometry with this code you should ideally, immediately after
> conversion:
>
> 1) set the spatial reference (including coordinate resolution/
> tolerance) to match the target feature class;
> 2) set IsKnownSimple for the geometry to FALSE and then perform an
> ITopologicalOperator.Simplify().
>
> Otherwise you may get geometry errors reported by esri.
>
> John
>
> GIS4Businesshttp://
www.gis4business.co.uk