ThinkGeo.com    |     Documentation    |     Premium Support

PointShape.Buffer throws an exception when the distance parameter is too small

I have a method that tries to find the shape closest to the point where the user double-clicks. My code is based on the IsShapeNearPoint method given, as an example, here:


gis.thinkgeo.com/Support/Dis...fault.aspx


However, when the map is zoomed to a very small scale (approximately 54)  the call to ExtentHelper.GetWorldDistanceBetweenTwoScreenPoints returns a very small value - for example, .09 meters. Calling


worldSearchPoint.Buffer(0.09487569, GeographyUnit.DecimalDegree, DistanceUnitMeter)


When the worldSearchPoint has a setting of -80.059778xxxx, 26.849395xxxx


will generate the following exception:


GeometryCollection is not supported


For now I am adding guard conditions so this code is not called when the distance value is less than .1. Is there another way around this?


Here's the stack trace:


StackTrace at ThinkGeo.MapSuite.Core.x6041512f2ec33335.xa5a7d40bd00e96ed(BinaryReader x757535de42769030) at ThinkGeo.MapSuite.Core.x6041512f2ec33335.xa284b768fee41d24(Byte[] x1a22eb38b50994c5) at ThinkGeo.MapSuite.Core.x6041512f2ec33335.xc4e11096691c8c3e(Geometry x97cc877ede0295ad) at ThinkGeo.MapSuite.Core.BaseShape.BufferCore(Double distance, Int32 quadrantSegments, BufferCapType bufferCapType, GeographyUnit shapeUnit, DistanceUnit distanceUnit) at ThinkGeo.MapSuite.Core.BaseShape.Buffer(Double distance, GeographyUnit shapeUnit, DistanceUnit distanceUnit) at Framework.Services.Sketch.Renderers.Desktop30.Classes.MapShapeLayer.IsShapeNearPoint(ScreenPointF screenSearchPoint, BaseShape searchShape, Int32 pixelTolerance, GeographyUnit mapUnit, RectangleShape currentExtent, Single mapWidth, Single mapHeight)



Gregory, 



Thank you that you attached your data that I can test. 



But I can not recreate the exception, it works properly.



 



PointShape pointShape = new PointShape(-80.059778, 26.849395);MultipolygonShape multipolygonShape = pointShape.Buffer(0.09487569, GeographyUnit.DecimalDegree, DistanceUnit.Meter);

I use the latest version(3.1.299) of DesktopEdition to test.

If my code is not right please le me know. Or you still encouter exception but use different version, please let me know your version. You can get version by calling the static method GetVersion on the Winforms Map control. 

 


Thanks


James