# Get Features from layer with reference to two layer column values

**URL:** <https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499>\
**Category:** WinForms\
**Created:** [December 23, 2014, 11:08pm UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499 "2014-12-23T23:08:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [December 23, 2014, 11:08pm UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/1 "2014-12-23T23:08:21Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;&nbsp;I&nbsp;have&nbsp;two&nbsp;layers.&nbsp;Both&nbsp;layer&nbsp;has&nbsp;columns.&nbsp;Using&nbsp;that&nbsp;column&nbsp;values&nbsp;difference&nbsp;I&nbsp;want&nbsp;to&nbsp;find&nbsp;features&nbsp;from&nbsp;one&nbsp;layer.&nbsp;I&nbsp;know&nbsp;the&nbsp;option&nbsp;of&nbsp;one&nbsp;layer&nbsp;to&nbsp;get&nbsp;feature&nbsp;by&nbsp;column&nbsp;values  
  
  
  
&nbsp;&nbsp;inmemorylayer.FeatureSource.GetFeaturesByColumnValue()&nbsp;which&nbsp;works&nbsp;for&nbsp;layers&nbsp;own&nbsp;column&nbsp;values.  
  
  
  
&nbsp;&nbsp;Example&nbsp;:  
  
&nbsp;&nbsp;  
  
&nbsp;&nbsp;layer1&nbsp;column&nbsp;A-&nbsp;value&nbsp;10  
  
&nbsp;&nbsp;layer2&nbsp;column&nbsp;B-&nbsp;value&nbsp;20  
  
  
  
&nbsp;&nbsp;From&nbsp;layer1&nbsp;find&nbsp;the&nbsp;features&nbsp;which&nbsp;values&nbsp;are&nbsp;less&nbsp;or&nbsp;equal&nbsp;to&nbsp;(layer2&nbsp;Column&nbsp;B&nbsp;-&nbsp;layer1&nbsp;Column&nbsp;A).  
  
  
  
&nbsp;&nbsp;Using&nbsp;loop&nbsp;and&nbsp;checking&nbsp;individual&nbsp;conditions&nbsp;I&nbsp;am&nbsp;able&nbsp;to&nbsp;get&nbsp;it.&nbsp;But&nbsp;any&nbsp;other&nbsp;way&nbsp;without&nbsp;loop&nbsp;we&nbsp;can&nbsp;get&nbsp;it.&nbsp;Please&nbsp;suggest&nbsp;the&nbsp;way&nbsp;to&nbsp;get&nbsp;it.  
  
  
  
Thanks,  
  
Goral  
  
&nbsp;

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [December 24, 2014, 1:15am UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/2 "2014-12-24T01:15:47Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;If&nbsp;you&nbsp;want&nbsp;to&nbsp;implement&nbsp;statistics&nbsp;cross&nbsp;multiply&nbsp;layers,&nbsp;I&nbsp;think&nbsp;the&nbsp;way&nbsp;you&nbsp;mentioned&nbsp;to&nbsp;loop&nbsp;all&nbsp;the&nbsp;features&nbsp;by&nbsp;group&nbsp;and&nbsp;write&nbsp;your&nbsp;own&nbsp;logic&nbsp;for&nbsp;compare&nbsp;is&nbsp;already&nbsp;the&nbsp;best&nbsp;solution.&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;columns&nbsp;of&nbsp;features&nbsp;in&nbsp;layer&nbsp;is&nbsp;just&nbsp;saved&nbsp;like&nbsp;collection,&nbsp;so&nbsp;you&nbsp;can&nbsp;handle&nbsp;them&nbsp;like&nbsp;collection.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [December 24, 2014, 1:18am UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/3 "2014-12-24T01:18:28Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;Thanks&nbsp;for&nbsp;reply.  
  
  
  
Goral

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [December 24, 2014, 11:21pm UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/4 "2014-12-24T23:21:34Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;question&nbsp;please&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [December 25, 2014, 1:42am UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/5 "2014-12-25T01:42:10Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;&nbsp;I&nbsp;have&nbsp;one&nbsp;more&nbsp;question&nbsp;related&nbsp;to&nbsp;this&nbsp;so&nbsp;I&nbsp;am&nbsp;adding&nbsp;in&nbsp;this&nbsp;only.&nbsp;  
  
  
  
&nbsp;&nbsp;In&nbsp;one&nbsp;layer&nbsp;column&nbsp;values&nbsp;"",100,200&nbsp;etc.&nbsp;I&nbsp;want&nbsp;the&nbsp;features&nbsp;which&nbsp;value&nbsp;is&nbsp;not&nbsp;"".&nbsp;In&nbsp;GetFeatureByColumnvalue()&nbsp;I&nbsp;am&nbsp;getting&nbsp;which&nbsp;value&nbsp;feature&nbsp;I&nbsp;want&nbsp;to&nbsp;get.&nbsp;Please&nbsp;suggest&nbsp;how&nbsp;to&nbsp;get&nbsp;it.  
  
  
  
Thanks,  
  
Goral

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [December 26, 2014, 1:58am UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/6 "2014-12-26T01:58:43Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;We&nbsp;could&nbsp;filter&nbsp;these&nbsp;empty&nbsp;columns&nbsp;by&nbsp;LINQ&nbsp;statement.&nbsp;Would&nbsp;you&nbsp;please&nbsp;try&nbsp;codes&nbsp;below?&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layer.Open();&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List\<Feature\>&nbsp;filterdFeatures&nbsp;=&nbsp;layer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns)&nbsp;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Where(feature&nbsp;=\>&nbsp;feature.ColumnValues["columnName"]&nbsp;!=&nbsp;string.Empty).ToList();&nbsp;  
&nbsp;&nbsp;  
&nbsp;Hope&nbsp;it&nbsp;helps&nbsp;and&nbsp;any&nbsp;question&nbsp;please&nbsp;don’t&nbsp;hesitate&nbsp;to&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Goral](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/g/4491bb/32.png) [@Goral](https://community.thinkgeo.com/u/Goral)\
**Post date:** [December 26, 2014, 6:05am UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/7 "2014-12-26T06:05:21Z")

</div>

Hi,  
  
  
  
&nbsp;&nbsp;Thanks&nbsp;for&nbsp;reply.&nbsp;Ya&nbsp;its&nbsp;working&nbsp;fine&nbsp;and&nbsp;very&nbsp;helpful.  
  
  
  
Goral

---

<div class="post-metadata">

**Author:** ![Troy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/85f322/32.png) [@Troy](https://community.thinkgeo.com/u/Troy)\
**Post date:** [December 28, 2014, 7:29pm UTC](https://community.thinkgeo.com/t/get-features-from-layer-with-reference-to-two-layer-column-values/2499/8 "2014-12-28T19:29:20Z")

</div>

Hi&nbsp;Goral,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Glad&nbsp;to&nbsp;it&nbsp;works&nbsp;fine.&nbsp;Let&nbsp;us&nbsp;know&nbsp;if&nbsp;we&nbsp;can&nbsp;be&nbsp;of&nbsp;any&nbsp;additional&nbsp;assistance.
