# Data binding

**URL:** <https://community.thinkgeo.com/t/data-binding/677>\
**Category:** WinForms\
**Created:** [September 10, 2009, 3:07pm UTC](https://community.thinkgeo.com/t/data-binding/677 "2009-09-10T15:07:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wouter\_boasson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/w/439d5e/32.png) [@wouter\_boasson](https://community.thinkgeo.com/u/wouter_boasson)\
**Post date:** [September 10, 2009, 3:07pm UTC](https://community.thinkgeo.com/t/data-binding/677/1 "2009-09-10T15:07:32Z")

</div>

Dear&nbsp;people,

In&nbsp;our&nbsp;process&nbsp;of&nbsp;testing&nbsp;mapping&nbsp;suites&nbsp;I&nbsp;tried&nbsp;to&nbsp;bind&nbsp;a&nbsp;.NET&nbsp;datatable&nbsp;in&nbsp;straightforward&nbsp;manner&nbsp;to&nbsp;a&nbsp;geodataset/layer&nbsp;in&nbsp;MapSuite&nbsp;3.0&nbsp;(trial).&nbsp;I&nbsp;probably&nbsp;overlooked&nbsp;something,&nbsp;can&nbsp;anyone&nbsp;help&nbsp;me&nbsp;with&nbsp;this?

I'm&nbsp;using&nbsp;both&nbsp;PostGIS&nbsp;(where's&nbsp;the&nbsp;schema&nbsp;support?)&nbsp;and&nbsp;Shapefile&nbsp;layers.

Thanks&nbsp;for&nbsp;helping,

Wouter

&nbsp;

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [September 11, 2009, 2:26am UTC](https://community.thinkgeo.com/t/data-binding/677/2 "2009-09-11T02:26:53Z")

</div>

Wouter,&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;I&nbsp;am&nbsp;not&nbsp;exactly&nbsp;sure&nbsp;what&nbsp;you&nbsp;tried&nbsp;to&nbsp;do.&nbsp;&nbsp;The&nbsp;Layers&nbsp;and&nbsp;FeatureSource&nbsp;objects&nbsp;do&nbsp;not&nbsp;support&nbsp;binding&nbsp;on&nbsp;them.&nbsp;&nbsp;The&nbsp;results&nbsp;from&nbsp;a&nbsp;FeatureSource&nbsp;or&nbsp;layer&nbsp;is&nbsp;not&nbsp;a&nbsp;data&nbsp;table&nbsp;and&nbsp;is&nbsp;instead&nbsp;a&nbsp;collection&nbsp;of&nbsp;Feature&nbsp;instances.&nbsp;&nbsp;A&nbsp;feature&nbsp;is&nbsp;a&nbsp;structure&nbsp;containing&nbsp;the&nbsp;well&nbsp;known&nbsp;binary&nbsp;of&nbsp;the&nbsp;geometry&nbsp;and&nbsp;also&nbsp;holds&nbsp;a&nbsp;dictionary&nbsp;of&nbsp;the&nbsp;attribute&nbsp;keys&nbsp;and&nbsp;values&nbsp;associated&nbsp;to&nbsp;them.&nbsp;&nbsp;If&nbsp;you&nbsp;have&nbsp;some&nbsp;code&nbsp;to&nbsp;share&nbsp;maybe&nbsp;it&nbsp;would&nbsp;enlighten&nbsp;me&nbsp;as&nbsp;to&nbsp;what&nbsp;you&nbsp;are&nbsp;trying&nbsp;to&nbsp;do.&nbsp;&nbsp;The&nbsp;more&nbsp;detail&nbsp;the&nbsp;better&nbsp;as&nbsp;well&nbsp;on&nbsp;your&nbsp;scenario.&nbsp;  
&nbsp;&nbsp;  
&nbsp;David

---

<div class="post-metadata">

**Author:** ![wouter\_boasson](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/w/439d5e/32.png) [@wouter\_boasson](https://community.thinkgeo.com/u/wouter_boasson)\
**Post date:** [September 11, 2009, 7:41am UTC](https://community.thinkgeo.com/t/data-binding/677/3 "2009-09-11T07:41:11Z")

</div>

David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I’ll&nbsp;explain&nbsp;what&nbsp;we&nbsp;need,&nbsp;as&nbsp;in&nbsp;my&nbsp;opinion,&nbsp;this&nbsp;should&nbsp;be&nbsp;basic&nbsp;functionality&nbsp;of&nbsp;a&nbsp;GIS.&nbsp;  
&nbsp;&nbsp;  
&nbsp;We&nbsp;do&nbsp;calculations&nbsp;on&nbsp;data&nbsp;from&nbsp;varying&nbsp;data&nbsp;sources,&nbsp;and&nbsp;perform&nbsp;them&nbsp;in-memory.&nbsp;Not&nbsp;only&nbsp;the&nbsp;datasources&nbsp;are&nbsp;varying,&nbsp;but&nbsp;also&nbsp;the&nbsp;calculations.&nbsp;They&nbsp;have&nbsp;one&nbsp;thing&nbsp;in&nbsp;common:&nbsp;they&nbsp;all&nbsp;end&nbsp;up&nbsp;grouped&nbsp;by&nbsp;zip-code.&nbsp;So&nbsp;we&nbsp;end&nbsp;up&nbsp;with&nbsp;a&nbsp;in-memory&nbsp;.NET&nbsp;datatable&nbsp;with&nbsp;zip-codes,&nbsp;and&nbsp;associated&nbsp;calculated&nbsp;values.&nbsp;  
&nbsp;What&nbsp;we&nbsp;now&nbsp;want&nbsp;to&nbsp;do&nbsp;is&nbsp;visualize&nbsp;these&nbsp;new&nbsp;values&nbsp;on&nbsp;a&nbsp;map.&nbsp;This&nbsp;should&nbsp;be&nbsp;done&nbsp;by&nbsp;retrieving&nbsp;a&nbsp;zip-code&nbsp;feature&nbsp;layer,&nbsp;which&nbsp;includes&nbsp;a&nbsp;zip-code&nbsp;attribute,&nbsp;and&nbsp;(based&nbsp;on&nbsp;zip-code)&nbsp;add&nbsp;our&nbsp;newly&nbsp;calculated&nbsp;values&nbsp;&nbsp;to&nbsp;the&nbsp;features,&nbsp;in&nbsp;order&nbsp;to&nbsp;thematically&nbsp;map&nbsp;them,&nbsp;e.g.&nbsp;with&nbsp;varying&nbsp;point&nbsp;size,&nbsp;or&nbsp;in&nbsp;different&nbsp;colors.&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;most&nbsp;common&nbsp;way&nbsp;to&nbsp;achieve&nbsp;the&nbsp;desired&nbsp;result&nbsp;is&nbsp;to&nbsp;simply&nbsp;join&nbsp;the&nbsp;new&nbsp;datatable&nbsp;with&nbsp;the&nbsp;featurelayer,&nbsp;based&nbsp;on&nbsp;zip-codes.&nbsp;Then&nbsp;the&nbsp;features&nbsp;simple&nbsp;get&nbsp;the&nbsp;new&nbsp;attributes&nbsp;and&nbsp;values&nbsp;added&nbsp;to&nbsp;them.&nbsp;This&nbsp;is&nbsp;a&nbsp;common&nbsp;GIS&nbsp;operation,&nbsp;so&nbsp;I&nbsp;assumed&nbsp;that&nbsp;it&nbsp;must&nbsp;be&nbsp;possible&nbsp;in&nbsp;one&nbsp;or&nbsp;another&nbsp;way.&nbsp;  
&nbsp;&nbsp;  
&nbsp;You&nbsp;could&nbsp;compare&nbsp;it&nbsp;to&nbsp;having&nbsp;an&nbsp;Excel&nbsp;sheet&nbsp;with&nbsp;zip-codes&nbsp;and&nbsp;population&nbsp;data,&nbsp;and&nbsp;a&nbsp;featurelayer&nbsp;with&nbsp;zip-codes.&nbsp;Load&nbsp;them&nbsp;both&nbsp;in&nbsp;a&nbsp;desktop&nbsp;GIS,&nbsp;and&nbsp;join&nbsp;the&nbsp;Excel&nbsp;data&nbsp;based&nbsp;on&nbsp;zip-codes&nbsp;in&nbsp;order&nbsp;to&nbsp;draw&nbsp;a&nbsp;map&nbsp;of&nbsp;population&nbsp;densities.&nbsp;This&nbsp;is&nbsp;a&nbsp;basic&nbsp;operation&nbsp;for&nbsp;almost&nbsp;every&nbsp;desktop&nbsp;GIS.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;hope&nbsp;that&nbsp;this&nbsp;shed&nbsp;some&nbsp;light&nbsp;on&nbsp;my&nbsp;question!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Wouter&nbsp;

---

<div class="post-metadata">

**Author:** ![David](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@David](https://community.thinkgeo.com/u/David)\
**Post date:** [September 13, 2009, 8:36pm UTC](https://community.thinkgeo.com/t/data-binding/677/4 "2009-09-13T20:36:27Z")

</div>

Wouter,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;understand&nbsp;much&nbsp;better&nbsp;now.&nbsp;&nbsp;We&nbsp;can&nbsp;facilitate&nbsp;this&nbsp;but&nbsp;in&nbsp;another&nbsp;way.&nbsp;&nbsp;I&nbsp;think&nbsp;the&nbsp;key&nbsp;thing&nbsp;you&nbsp;said&nbsp;that&nbsp;that&nbsp;'it&nbsp;is&nbsp;a&nbsp;basic&nbsp;operation&nbsp;for&nbsp;almost&nbsp;every&nbsp;Desktop&nbsp;GIS".&nbsp;&nbsp;I&nbsp;agree&nbsp;with&nbsp;you&nbsp;but&nbsp;what&nbsp;we&nbsp;offer&nbsp;are&nbsp;components&nbsp;for&nbsp;building&nbsp;desktop&nbsp;GIS&nbsp;systems&nbsp;and&nbsp;I&nbsp;agree&nbsp;that&nbsp;many&nbsp;off&nbsp;the&nbsp;shelf&nbsp;desktop&nbsp;GIS&nbsp;viewers&nbsp;like&nbsp;ArcView&nbsp;do&nbsp;this&nbsp;we&nbsp;see&nbsp;it&nbsp;as&nbsp;something&nbsp;above&nbsp;our&nbsp;outside&nbsp;of&nbsp;the&nbsp;component.&nbsp;&nbsp;We&nbsp;do&nbsp;offer&nbsp;ways&nbsp;to&nbsp;link&nbsp;the&nbsp;data&nbsp;just&nbsp;not&nbsp;at&nbsp;the&nbsp;high&nbsp;level&nbsp;you&nbsp;might&nbsp;expect.&nbsp;&nbsp;We&nbsp;see&nbsp;it&nbsp;as&nbsp;a&nbsp;high&nbsp;level&nbsp;operation&nbsp;and&nbsp;what&nbsp;we&nbsp;offer&nbsp;out&nbsp;of&nbsp;the&nbsp;box&nbsp;is&nbsp;rather&nbsp;low&nbsp;level.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;In&nbsp;our&nbsp;system&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;join&nbsp;column&nbsp;data&nbsp;from&nbsp;one&nbsp;dataset&nbsp;to&nbsp;the&nbsp;main&nbsp;features&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;CustomColumnFetchEvent.&nbsp;&nbsp;I&nbsp;am&nbsp;providing&nbsp;a&nbsp;link&nbsp;below&nbsp;with&nbsp;some&nbsp;sample&nbsp;code&nbsp;to&nbsp;show&nbsp;you&nbsp;how&nbsp;it&nbsp;works.&nbsp;&nbsp;In&nbsp;a&nbsp;nutshell&nbsp;on&nbsp;the&nbsp;FeatureSource&nbsp;there&nbsp;is&nbsp;an&nbsp;event&nbsp;called&nbsp;CustomColumnFetch.&nbsp;&nbsp;Whenever&nbsp;you&nbsp;want&nbsp;to&nbsp;use&nbsp;data&nbsp;from&nbsp;another&nbsp;source&nbsp;to&nbsp;join&nbsp;it&nbsp;with&nbsp;your&nbsp;other&nbsp;data&nbsp;you&nbsp;can&nbsp;reference&nbsp;the&nbsp;field&nbsp;as&nbsp;normally&nbsp;in&nbsp;our&nbsp;styles&nbsp;etc&nbsp;and&nbsp;when&nbsp;it&nbsp;goes&nbsp;to&nbsp;find&nbsp;it&nbsp;it&nbsp;will&nbsp;see&nbsp;that&nbsp;that&nbsp;field&nbsp;is&nbsp;not&nbsp;really&nbsp;part&nbsp;of&nbsp;the&nbsp;feature&nbsp;source.&nbsp;&nbsp;After&nbsp;that&nbsp;it&nbsp;will&nbsp;raise&nbsp;the&nbsp;above&nbsp;event.&nbsp;&nbsp;The&nbsp;event&nbsp;will&nbsp;pass&nbsp;you&nbsp;the&nbsp;feature&nbsp;ID&nbsp;and&nbsp;the&nbsp;feature&nbsp;and&nbsp;you&nbsp;can&nbsp;go&nbsp;into&nbsp;your&nbsp;data&nbsp;table,&nbsp;find&nbsp;the&nbsp;row&nbsp;that&nbsp;is&nbsp;is&nbsp;associated&nbsp;with&nbsp;and&nbsp;return&nbsp;the&nbsp;vale&nbsp;for&nbsp;the&nbsp;requested&nbsp;field&nbsp;in&nbsp;the&nbsp;event.&nbsp;&nbsp;&nbsp;In&nbsp;this&nbsp;way&nbsp;you&nbsp;are&nbsp;joining&nbsp;the&nbsp;data.&nbsp;&nbsp;We&nbsp;did&nbsp;it&nbsp;this&nbsp;way&nbsp;so&nbsp;it&nbsp;would&nbsp;be&nbsp;flexible&nbsp;for&nbsp;not&nbsp;just&nbsp;data&nbsp;tables&nbsp;but&nbsp;from&nbsp;anything&nbsp;you&nbsp;wanted&nbsp;to&nbsp;use.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;In&nbsp;the&nbsp;sample&nbsp;at&nbsp;the&nbsp;link&nbsp;below&nbsp;the&nbsp;style&nbsp;references&nbsp;a&nbsp;column&nbsp;called&nbsp;‘custom’&nbsp;that&nbsp;does&nbsp;not&nbsp;exist&nbsp;in&nbsp;the&nbsp;feature&nbsp;source.&nbsp;&nbsp;It&nbsp;will&nbsp;cause&nbsp;the&nbsp;event&nbsp;to&nbsp;be&nbsp;raised&nbsp;and&nbsp;inside&nbsp;of&nbsp;the&nbsp;event&nbsp;you&nbsp;can&nbsp;do&nbsp;whatever&nbsp;you&nbsp;need&nbsp;to&nbsp;fill&nbsp;in&nbsp;the&nbsp;missing&nbsp;data.&nbsp;&nbsp;I&nbsp;think&nbsp;it&nbsp;would&nbsp;be&nbsp;very&nbsp;possible&nbsp;to&nbsp;build&nbsp;a&nbsp;feature&nbsp;source&nbsp;that&nbsp;took&nbsp;a&nbsp;data&nbsp;table&nbsp;to&nbsp;make&nbsp;the&nbsp;process&nbsp;more&nbsp;streamline.&nbsp;&nbsp;We&nbsp;would&nbsp;know&nbsp;the&nbsp;key&nbsp;from&nbsp;the&nbsp;feature&nbsp;and&nbsp;the&nbsp;key&nbsp;in&nbsp;the&nbsp;table&nbsp;to&nbsp;search&nbsp;one.&nbsp;&nbsp;We&nbsp;found&nbsp;that&nbsp;data&nbsp;tables&nbsp;were&nbsp;not&nbsp;all&nbsp;that&nbsp;fast&nbsp;when&nbsp;doing&nbsp;lots&nbsp;of&nbsp;look-ups.&nbsp;&nbsp;We&nbsp;suggest&nbsp;people&nbsp;use&nbsp;dictionaries&nbsp;that&nbsp;contain&nbsp;a&nbsp;dictionary&nbsp;of&nbsp;the&nbsp;columns&nbsp;as&nbsp;the&nbsp;key&nbsp;and&nbsp;values&nbsp;as&nbsp;the&nbsp;column&nbsp;values.&nbsp;&nbsp;This&nbsp;look-up&nbsp;us&nbsp;very&nbsp;fast&nbsp;in&nbsp;real-time.&nbsp;&nbsp;This&nbsp;all&nbsp;depends&nbsp;on&nbsp;how&nbsp;much&nbsp;data&nbsp;you&nbsp;will&nbsp;be&nbsp;using&nbsp;etc.&nbsp;  
&nbsp;&nbsp;  
&nbsp;[gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5966/afv/topic/Default.aspx](http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5966/afv/topic/Default.aspx)&nbsp;  
&nbsp;&nbsp;  
&nbsp;David
