# Spatial query or otherwise with particular shapefile and coponent version 3.1.299 or higher

**URL:** <https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147>\
**Category:** WinForms\
**Created:** [April 9, 2010, 12:24pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147 "2010-04-09T12:24:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nelson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nelson](https://community.thinkgeo.com/u/Nelson)\
**Post date:** [April 9, 2010, 12:24pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/1 "2010-04-09T12:24:33Z")

</div>

Hello,

Please&nbsp;see&nbsp;the&nbsp;attached&nbsp;demo.&nbsp;Click&nbsp;select.&nbsp;This&nbsp;will&nbsp;enable&nbsp;rectangle&nbsp;track&nbsp;shapes.&nbsp;Make&nbsp;a&nbsp;track&nbsp;shape&nbsp;and&nbsp;watch&nbsp;the&nbsp;exception&nbsp;take&nbsp;place.&nbsp;The&nbsp;exception&nbsp;says:&nbsp;"An&nbsp;item&nbsp;with&nbsp;the&nbsp;same&nbsp;key&nbsp;has&nbsp;already&nbsp;been&nbsp;added."&nbsp;This&nbsp;is&nbsp;an&nbsp;urgent&nbsp;matter&nbsp;as&nbsp;we&nbsp;have&nbsp;discovered&nbsp;this&nbsp;error&nbsp;on&nbsp;a&nbsp;customers&nbsp;site&nbsp;on&nbsp;the&nbsp;date&nbsp;of&nbsp;installation&nbsp;an&nbsp;can't&nbsp;conceive&nbsp;a&nbsp;work&nbsp;around&nbsp;at&nbsp;this&nbsp;time.&nbsp;Other&nbsp;shapefiles&nbsp;work&nbsp;as&nbsp;expected.

I&nbsp;tried&nbsp;to&nbsp;run&nbsp;Shapefilefeaturelayer.Validate&nbsp;and&nbsp;Rebuild&nbsp;but&nbsp;nothing&nbsp;different&nbsp;happened.&nbsp;Please&nbsp;advise.

&nbsp;

Thanks,

Nelson

[1943-TrackToolTest.zip](https://community.thinkgeo.com/uploads/default/original/1X/698733ab3337c2fd7fb07bde6a7d8f04d128e654.zip) (321 KB)

---

<div class="post-metadata">

**Author:** ![Val](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/v/e56c9b/32.png) [@Val](https://community.thinkgeo.com/u/Val)\
**Post date:** [April 9, 2010, 2:06pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/2 "2010-04-09T14:06:03Z")

</div>

Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;post.&nbsp;We&nbsp;will&nbsp;look&nbsp;at&nbsp;this&nbsp;matter&nbsp;as&nbsp;soon&nbsp;as&nbsp;possible.&nbsp;You&nbsp;should&nbsp;have&nbsp;the&nbsp;response&nbsp;by&nbsp;Monday&nbsp;afternoon.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 11, 2010, 8:25pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/3 "2010-04-11T20:25:51Z")

</div>

Nelson,

Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;question,&nbsp;hope&nbsp;my&nbsp;following&nbsp;answer&nbsp;can&nbsp;give&nbsp;you&nbsp;some&nbsp;help.  
&nbsp;  
Following&nbsp;screenshot&nbsp;shows&nbsp;part&nbsp;of&nbsp;the&nbsp;columns&nbsp;in&nbsp;the&nbsp;contained&nbsp;shape&nbsp;file.&nbsp;You&nbsp;can&nbsp;see&nbsp;that&nbsp;the&nbsp;third&nbsp;column&nbsp;value&nbsp;is&nbsp;“PAR\_SIZE\_0”,&nbsp;and&nbsp;the&nbsp;forth&nbsp;one&nbsp;is&nbsp;“PAR\_SIZE\_01”.&nbsp;When&nbsp;dbf&nbsp;read&nbsp;the&nbsp;two&nbsp;columns,&nbsp;it&nbsp;will&nbsp;only&nbsp;accept&nbsp;8&nbsp;characters&nbsp;which&nbsp;will&nbsp;get&nbsp;“PAR\_SIZE\_0”&nbsp;for&nbsp;both&nbsp;of&nbsp;them.&nbsp;So&nbsp;there&nbsp;are&nbsp;couple&nbsp;of&nbsp;solutions&nbsp;now&nbsp;to&nbsp;go&nbsp;around&nbsp;your&nbsp;problem:

 ![](https://community.thinkgeo.com/uploads/default/original/2X/0/0a37505b445c96acf77d9648972e4eac45a59b3b.png)  
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change&nbsp;the&nbsp;DBF&nbsp;column&nbsp;name&nbsp;for&nbsp;forth&nbsp;column,&nbsp;for&nbsp;example,&nbsp;change&nbsp;to&nbsp;PAR\_SIZE\_1&nbsp;or&nbsp;something.  
2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Change&nbsp;the&nbsp;code&nbsp;as&nbsp;following&nbsp;in&nbsp;your&nbsp;sample:  
  
&nbsp;  
`        Private Sub TrackOverlay_TrackEnded(ByVal sender As Object, ByVal e As TrackEndedTrackInteractiveOverlayEventArgs)        Select Case tool_mode            Case 0                Exit Select            Case 1 'Select                map.CurrentExtent = e.TrackShape.GetBoundingBox()                map.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear()                Dim worldLayer As New ShapeFileFeatureLayer("C:\ThinkGeo_YangYong\MapSuite3\Support\DesktopEdition\Posts\Post7359\TrackToolTest\shp\parcels.shp")                Dim fCollection As Collection(Of Feature)                Dim UID_Field_SHP As String = "UID"                If worldLayer.IsOpen = False Then worldLayer.Open()                fCollection = worldLayer.QueryTools.GetFeaturesIntersecting(e.TrackShape, New String(-1) {})                worldLayer.Close()            Case 2 'ZoomOut                Dim trackShape As New Feature(e.TrackShape)                map.ZoomOutToCenter(135, trackShape)                map.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear()                Exit Select            Case Else                Exit Select        End Select        map.Refresh()    End Sub`  
  
3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In&nbsp;the&nbsp;above&nbsp;code,&nbsp;the&nbsp;return&nbsp;features&nbsp;fCollection&nbsp;did&nbsp;not&nbsp;contain&nbsp;any&nbsp;column&nbsp;value&nbsp;information.&nbsp;So&nbsp;if&nbsp;you&nbsp;really&nbsp;want&nbsp;these&nbsp;information,&nbsp;please&nbsp;get&nbsp;the&nbsp;columns&nbsp;collection&nbsp;first&nbsp;and&nbsp;then&nbsp;filter&nbsp;out&nbsp;the&nbsp;forth&nbsp;one&nbsp;(duplicate&nbsp;one)&nbsp;and&nbsp;then&nbsp;pass&nbsp;in&nbsp;the&nbsp;collection.&nbsp;That&nbsp;should&nbsp;work,&nbsp;while&nbsp;I&nbsp;did&nbsp;not&nbsp;test&nbsp;this.  
&nbsp;  
Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 11, 2010, 8:52pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/4 "2010-04-11T20:52:45Z")

</div>

Nelson,

Just&nbsp;change&nbsp;a&nbsp;mistake&nbsp;in&nbsp;above&nbsp;post&nbsp;after&nbsp;talking&nbsp;with&nbsp;our&nbsp;author&nbsp;of&nbsp;dbf.  
&nbsp;  
The&nbsp;dbf&nbsp;third&nbsp;column&nbsp;and&nbsp;forth&nbsp;column&nbsp;are&nbsp;the&nbsp;same&nbsp;in&nbsp;dbf,&nbsp;you&nbsp;can&nbsp;verify&nbsp;this&nbsp;by&nbsp;opening&nbsp;it&nbsp;in&nbsp;a&nbsp;binary&nbsp;format&nbsp;like&nbsp;Notepad++.&nbsp;The&nbsp;SQL&nbsp;server&nbsp;result&nbsp;is&nbsp;processed&nbsp;by&nbsp;OLEDB&nbsp;by&nbsp;adding&nbsp;a&nbsp;1&nbsp;or&nbsp;2&nbsp;after&nbsp;if&nbsp;it&nbsp;is&nbsp;duplicated.&nbsp;We&nbsp;cannot&nbsp;do&nbsp;this&nbsp;change&nbsp;because&nbsp;this&nbsp;will&nbsp;somehow&nbsp;alter&nbsp;the&nbsp;data.  
&nbsp;  
Just&nbsp;let&nbsp;you&nbsp;know&nbsp;this.  
&nbsp;  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![Nelson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nelson](https://community.thinkgeo.com/u/Nelson)\
**Post date:** [April 12, 2010, 1:06pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/5 "2010-04-12T13:06:59Z")

</div>

Thanks,&nbsp;Yale.&nbsp;I’ll&nbsp;recommend&nbsp;these&nbsp;changes.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 12, 2010, 7:50pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/6 "2010-04-12T19:50:46Z")

</div>

Nelson,&nbsp;  
&nbsp;&nbsp;  
&nbsp;No&nbsp;problem.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;

---

<div class="post-metadata">

**Author:** ![Nelson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/dec6dc/32.png) [@Nelson](https://community.thinkgeo.com/u/Nelson)\
**Post date:** [April 14, 2010, 11:59am UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/7 "2010-04-14T11:59:59Z")

</div>

Yale,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;think&nbsp;there&nbsp;is&nbsp;a&nbsp;discrepency&nbsp;between&nbsp;the&nbsp;limitations&nbsp;of&nbsp;dbf&nbsp;and&nbsp;what&nbsp;you’re&nbsp;stating…&nbsp;  
&nbsp;&nbsp;  
&nbsp;[en.wikipedia.org/wiki/Shapefile](http://en.wikipedia.org/wiki/Shapefile)&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;maximum&nbsp;length&nbsp;of&nbsp;a&nbsp;fieldname&nbsp;for&nbsp;a&nbsp;dbf&nbsp;is&nbsp;10&nbsp;characters.&nbsp;It&nbsp;is&nbsp;clear&nbsp;that&nbsp;Map&nbsp;Suite&nbsp;can&nbsp;handle&nbsp;this&nbsp;because&nbsp;the&nbsp;‘PERIMETER’&nbsp;field&nbsp;is&nbsp;9&nbsp;characters,&nbsp;which&nbsp;is&nbsp;of&nbsp;course&nbsp;over&nbsp;8.&nbsp;When&nbsp;you&nbsp;reach&nbsp;the&nbsp;10th&nbsp;characters,&nbsp;which&nbsp;is&nbsp;permisible&nbsp;by&nbsp;the&nbsp;dbf&nbsp;standard,&nbsp;that&nbsp;seems&nbsp;to&nbsp;be&nbsp;where&nbsp;map&nbsp;suite&nbsp;begins&nbsp;to&nbsp;run&nbsp;into&nbsp;erratic&nbsp;errors&nbsp;during&nbsp;queries.&nbsp;I&nbsp;have&nbsp;gotten&nbsp;errors&nbsp;of&nbsp;invalid&nbsp;record&nbsp;and&nbsp;‘An&nbsp;item&nbsp;with&nbsp;the&nbsp;same&nbsp;key&nbsp;already&nbsp;exists’&nbsp;and&nbsp;so&nbsp;on.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;have&nbsp;used&nbsp;the&nbsp;ShapeFileFeatureLayer.Validate&nbsp;method&nbsp;and&nbsp;sometimes&nbsp;this&nbsp;seems&nbsp;to&nbsp;auto-correct&nbsp;some&nbsp;field&nbsp;names&nbsp;as&nbsp;I&nbsp;am&nbsp;starting&nbsp;to&nbsp;notice.&nbsp;This&nbsp;is&nbsp;sort&nbsp;of&nbsp;a&nbsp;problem&nbsp;though…&nbsp;We&nbsp;need&nbsp;to&nbsp;allow&nbsp;our&nbsp;users&nbsp;to&nbsp;use&nbsp;10&nbsp;characters&nbsp;in&nbsp;the&nbsp;field&nbsp;name&nbsp;because&nbsp;10&nbsp;characters&nbsp;is&nbsp;very&nbsp;limiting&nbsp;as&nbsp;it&nbsp;is;&nbsp;we&nbsp;can&nbsp;not&nbsp;further&nbsp;restrict&nbsp;them…&nbsp;  
&nbsp;&nbsp;  
&nbsp;Are&nbsp;you&nbsp;sure&nbsp;this&nbsp;isn’t&nbsp;a&nbsp;bug&nbsp;in&nbsp;some&nbsp;validation&nbsp;code?&nbsp;Why&nbsp;can’t&nbsp;map&nbsp;suite&nbsp;accept&nbsp;10&nbsp;character&nbsp;field&nbsp;lengths?&nbsp;We&nbsp;are&nbsp;having&nbsp;a&nbsp;large&nbsp;quanitity&nbsp;of&nbsp;customer&nbsp;complaints&nbsp;at&nbsp;this&nbsp;time&nbsp;from&nbsp;‘random&nbsp;errors’&nbsp;that&nbsp;are&nbsp;really&nbsp;not&nbsp;random,&nbsp;they&nbsp;are&nbsp;just&nbsp;trying&nbsp;to&nbsp;query&nbsp;with&nbsp;datasets&nbsp;that&nbsp;have&nbsp;10&nbsp;character&nbsp;field&nbsp;names.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;hope&nbsp;I&nbsp;was&nbsp;clear.&nbsp;Thanks&nbsp;Yale.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 14, 2010, 10:05pm UTC](https://community.thinkgeo.com/t/spatial-query-or-otherwise-with-particular-shapefile-and-coponent-version-3-1-299-or-higher/1147/8 "2010-04-14T22:05:35Z")

</div>

Nelson,

I&nbsp;think&nbsp;you&nbsp;are&nbsp;clear:.  
&nbsp;  
I&nbsp;am&nbsp;sorry&nbsp;to&nbsp;say&nbsp;that&nbsp;I&nbsp;made&nbsp;a&nbsp;mistake&nbsp;in&nbsp;my&nbsp;previous&nbsp;post&nbsp;after&nbsp;more&nbsp;investigations&nbsp;into&nbsp;our&nbsp;dbf&nbsp;code;&nbsp;it&nbsp;is&nbsp;10&nbsp;characters&nbsp;instead&nbsp;of&nbsp;8&nbsp;we&nbsp;can&nbsp;support&nbsp;in&nbsp;our&nbsp;dbf&nbsp;module.&nbsp;More&nbsp;then&nbsp;10&nbsp;cannot&nbsp;be&nbsp;supported.&nbsp;I&nbsp;think&nbsp;I&nbsp;mistook&nbsp;this&nbsp;with&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;file&nbsp;name.  
&nbsp;  
In&nbsp;our&nbsp;validation,&nbsp;we&nbsp;just&nbsp;validate&nbsp;the&nbsp;shapes&nbsp;in&nbsp;the&nbsp;.shp&nbsp;file,&nbsp;to&nbsp;see&nbsp;it&nbsp;is&nbsp;standard&nbsp;or&nbsp;not.&nbsp;We&nbsp;do&nbsp;not&nbsp;have&nbsp;any&nbsp;check&nbsp;on&nbsp;the&nbsp;Dbf.  
&nbsp;  
Thanks.  
&nbsp;  
Yale
