# Buffer error

**URL:** <https://community.thinkgeo.com/t/buffer-error/2029>\
**Category:** WinForms\
**Created:** [July 13, 2012, 4:25pm UTC](https://community.thinkgeo.com/t/buffer-error/2029 "2012-07-13T16:25:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GIS\_ThinkGeo](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/d2c977/32.png) [@GIS\_ThinkGeo](https://community.thinkgeo.com/u/GIS_ThinkGeo)\
**Post date:** [July 13, 2012, 4:25pm UTC](https://community.thinkgeo.com/t/buffer-error/2029/1 "2012-07-13T16:25:00Z")

</div>

hello,

&nbsp;i&nbsp;have&nbsp;calculated&nbsp;a&nbsp;route.&nbsp;then&nbsp;find&nbsp;mid&nbsp;point&nbsp;of&nbsp;the&nbsp;route&nbsp;by&nbsp;using&nbsp;GetpointOnALine&nbsp;method.

now&nbsp;i&nbsp;want&nbsp;to&nbsp;create&nbsp;a&nbsp;buffer&nbsp;around&nbsp;that&nbsp;midpoint.&nbsp;but&nbsp;it&nbsp;give&nbsp;error&nbsp;when&nbsp;my&nbsp;app&nbsp;runs

" **Object&nbsp;reference&nbsp;not&nbsp;set&nbsp;to&nbsp;an&nbsp;instance&nbsp;of&nbsp;an&nbsp;object**."

my&nbsp;code&nbsp;is&nbsp;as&nbsp;follow

&nbsp;

InMemoryFeatureLayer&nbsp;buffer&nbsp;=&nbsp;(InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("Buffer");  
  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PointBaseShape&nbsp;baseshape&nbsp;=&nbsp;(PointBaseShape)center.InternalFeatures["Mid"].GetShape();  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MultipolygonShape&nbsp;buffershape&nbsp;=&nbsp;baseshape.Buffer(100,8,&nbsp;BufferCapType.Butt,&nbsp;GeographyUnit.DecimalDegree,&nbsp;DistanceUnit.Kilometer);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Feature&nbsp;bufferFeature&nbsp;=&nbsp;new&nbsp;Feature(buffershape.GetWellKnownBinary(),&nbsp;"BufferFeature");  
  
  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!buffer.InternalFeatures.Contains("BufferFeature"))  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;center.InternalFeatures.Add("Mid",&nbsp;mid);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer.InternalFeatures.Add("BufferFeature",&nbsp;bufferFeature);  
  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
  
&nbsp;

---

<div class="post-metadata">

**Author:** ![GIS\_ThinkGeo](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/d2c977/32.png) [@GIS\_ThinkGeo](https://community.thinkgeo.com/u/GIS_ThinkGeo)\
**Post date:** [July 15, 2012, 9:56am UTC](https://community.thinkgeo.com/t/buffer-error/2029/2 "2012-07-15T09:56:03Z")

</div>

i&nbsp;have&nbsp;solved&nbsp;this&nbsp;problem.&nbsp;kindly&nbsp;tell&nbsp;me&nbsp;how&nbsp;to&nbsp;select&nbsp;vertices&nbsp;lies&nbsp;within&nbsp;the&nbsp;buffer.&nbsp;i&nbsp;want&nbsp;to&nbsp;store&nbsp;vertex&nbsp;that&nbsp;are&nbsp;located&nbsp;inside&nbsp;the&nbsp;created&nbsp;buffer
