# MapShape features

**URL:** <https://community.thinkgeo.com/t/mapshape-features/456>\
**Category:** WinForms\
**Created:** [June 3, 2009, 12:49pm UTC](https://community.thinkgeo.com/t/mapshape-features/456 "2009-06-03T12:49:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/3da27b/32.png) [@Ryan1](https://community.thinkgeo.com/u/Ryan1)\
**Post date:** [June 3, 2009, 12:49pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/1 "2009-06-03T12:49:04Z")

</div>

Greetings,

I&nbsp;need&nbsp;to&nbsp;have&nbsp;some&nbsp;of&nbsp;the&nbsp;features&nbsp;of&nbsp;the&nbsp;old&nbsp;2.0&nbsp;MapShapes&nbsp;in&nbsp;my&nbsp;application.&nbsp;&nbsp;Specifically,&nbsp;I&nbsp;want&nbsp;to&nbsp;have&nbsp;each&nbsp;"MapShape"&nbsp;contain&nbsp;its&nbsp;own&nbsp;style.&nbsp;&nbsp;I&nbsp;saw&nbsp;your&nbsp;post&nbsp;on&nbsp;MapShapes,&nbsp;but&nbsp;the&nbsp;sample&nbsp;code&nbsp;doesn't&nbsp;seem&nbsp;to&nbsp;have&nbsp;anything&nbsp;for&nbsp;styling,&nbsp;so&nbsp;I&nbsp;went&nbsp;about&nbsp;trying&nbsp;to&nbsp;create&nbsp;it&nbsp;on&nbsp;my&nbsp;own.

My&nbsp;first&nbsp;idea&nbsp;was&nbsp;to&nbsp;inherit&nbsp;from&nbsp;Feature&nbsp;and&nbsp;store&nbsp;the&nbsp;style&nbsp;information&nbsp;in&nbsp;that,&nbsp;however&nbsp;the&nbsp;Feature&nbsp;class&nbsp;is&nbsp;sealed.&nbsp;&nbsp;What&nbsp;I&nbsp;ended&nbsp;up&nbsp;doing&nbsp;was&nbsp;creating&nbsp;classes&nbsp;that&nbsp;inherit&nbsp;from&nbsp;Polygon,&nbsp;LineShape,&nbsp;etc.&nbsp;that&nbsp;contains&nbsp;the&nbsp;style,&nbsp;and&nbsp;then&nbsp;add&nbsp;those&nbsp;to&nbsp;the&nbsp;feature,&nbsp;and&nbsp;create&nbsp;a&nbsp;custom&nbsp;layer&nbsp;that&nbsp;draws&nbsp;the&nbsp;features&nbsp;according&nbsp;to&nbsp;their&nbsp;own&nbsp;style.&nbsp;&nbsp;However,&nbsp;when&nbsp;I&nbsp;call&nbsp;feature.GetShape(),&nbsp;the&nbsp;objects&nbsp;returned&nbsp;are&nbsp;no&nbsp;longer&nbsp;of&nbsp;my&nbsp;created&nbsp;type,&nbsp;so&nbsp;I've&nbsp;lost&nbsp;all&nbsp;the&nbsp;style&nbsp;data.

How&nbsp;should&nbsp;I&nbsp;go&nbsp;about&nbsp;achieving&nbsp;this.&nbsp;&nbsp;I&nbsp;need&nbsp;all&nbsp;my&nbsp;"MapShapes"&nbsp;on&nbsp;a&nbsp;single&nbsp;layer,&nbsp;each&nbsp;with&nbsp;their&nbsp;own&nbsp;style.&nbsp;&nbsp;I&nbsp;also&nbsp;need&nbsp;the&nbsp;ability&nbsp;to&nbsp;do&nbsp;spatial&nbsp;queries&nbsp;on&nbsp;them&nbsp;(that&nbsp;is&nbsp;why&nbsp;I&nbsp;keep&nbsp;them&nbsp;in&nbsp;features&nbsp;rather&nbsp;than&nbsp;creating&nbsp;a&nbsp;custom&nbsp;layer&nbsp;that&nbsp;just&nbsp;stores&nbsp;MapShapes).

Any&nbsp;help&nbsp;would&nbsp;be&nbsp;appreaciated.&nbsp;&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;time.

.Ryan.

---

<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:** [June 3, 2009, 8:52pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/2 "2009-06-03T20:52:43Z")

</div>

Ryan,

&nbsp;That&nbsp;is&nbsp;a&nbsp;good&nbsp;and&nbsp;interesting&nbsp;question.&nbsp;I&nbsp;believe&nbsp;there&nbsp;are&nbsp;a&nbsp;couple&nbsp;of&nbsp;ways&nbsp;to&nbsp;achieve&nbsp;this&nbsp;based&nbsp;on&nbsp;the&nbsp;flexibility&nbsp;of&nbsp;MapSuite&nbsp;component.  
&nbsp;  
Following&nbsp;is&nbsp;a&nbsp;simple&nbsp;way&nbsp;to&nbsp;achieve&nbsp;this&nbsp;and&nbsp;also&nbsp;some&nbsp;sample&nbsp;codes,&nbsp;I&nbsp;used&nbsp;the&nbsp;latest&nbsp;build(3.0.307&nbsp;RC1&nbsp;Desktop)  
`public class StyledFeatureLayer : Layer    {        private Dictionary<Feature, Style> features;        public StyledFeatureLayer()            :this(new Dictionary<Feature,Style>())        { }        public StyledFeatureLayer(Dictionary<Feature, Style> features)            :base()        {            this.features = features;        }        public Dictionary<Feature, Style> Features        {            get { return features; }        }        protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)        {            Collection<SimpleCandidate> labelInThisLayer = new Collection<SimpleCandidate>();            Collection<SimpleCandidate> labelInAllLayers = new Collection<SimpleCandidate>();            foreach (Feature feature in features.Keys)            {                Style style = features[feature];                style.Draw(new Feature[] { feature }, canvas, labelInThisLayer, labelInAllLayers);            }        }    }Test codes:winformsMap1.MapUnit = GeographyUnit.Meter;            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);            winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None;            StyledFeatureLayer styledFeatureLayer = new StyledFeatureLayer();            BaseShape rectangle1 = new RectangleShape(0, 45, 45, 0);            Feature feature1 = new Feature(rectangle1);            BaseShape rectangle2 = new EllipseShape(new PointShape(45, 45), 5);            Feature feature2 = new Feature(rectangle2);            LineShape line1 = new LineShape();            line1.Vertices.Add(new Vertex(0, 0));            line1.Vertices.Add(new Vertex(45, 0));            line1.Vertices.Add(new Vertex(0, 45));            Feature feature3 = new Feature(line1);            styledFeatureLayer.Features.Add(feature1, AreaStyles.Country1);            styledFeatureLayer.Features.Add(feature2, AreaStyles.Grass1);            styledFeatureLayer.Features.Add(feature3, LineStyles.Canal1);            LayerOverlay staticOverlay = new LayerOverlay();            staticOverlay.Layers.Add("WorldLayer", styledFeatureLayer);            winformsMap1.Overlays.Add(staticOverlay);            winformsMap1.Refresh();`

Let&nbsp;me&nbsp;know&nbsp;if&nbsp;any&nbsp;more&nbsp;questions.

&nbsp;Thanks.  
Yale

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ryan1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/3da27b/32.png) [@Ryan1](https://community.thinkgeo.com/u/Ryan1)\
**Post date:** [June 4, 2009, 10:56am UTC](https://community.thinkgeo.com/t/mapshape-features/456/3 "2009-06-04T10:56:43Z")

</div>

Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;reply.&nbsp;&nbsp;I&nbsp;would&nbsp;also&nbsp;like&nbsp;the&nbsp;ability&nbsp;to&nbsp;perform&nbsp;spatial&nbsp;queries&nbsp;on&nbsp;my&nbsp;features.&nbsp;&nbsp;Specifically,&nbsp;I&nbsp;would&nbsp;like&nbsp;to&nbsp;determine&nbsp;if&nbsp;the&nbsp;user&nbsp;clicks&nbsp;on&nbsp;(or&nbsp;within&nbsp;a&nbsp;few&nbsp;pixels)&nbsp;of&nbsp;a&nbsp;feature.&nbsp;&nbsp;I&nbsp;was&nbsp;able&nbsp;to&nbsp;get&nbsp;this&nbsp;working&nbsp;using&nbsp;an&nbsp;InMemoryFeatureLayer,&nbsp;but&nbsp;that&nbsp;requires&nbsp;the&nbsp;ability&nbsp;to&nbsp;find&nbsp;the&nbsp;nearest&nbsp;feature&nbsp;to&nbsp;a&nbsp;point,&nbsp;which&nbsp;is&nbsp;made&nbsp;available&nbsp;by&nbsp;FeatureLayer.&nbsp;&nbsp;Maybe&nbsp;there&nbsp;is&nbsp;another&nbsp;way&nbsp;to&nbsp;do&nbsp;this&nbsp;that&nbsp;I&nbsp;am&nbsp;not&nbsp;aware&nbsp;of,&nbsp;or&nbsp;is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;add&nbsp;the&nbsp;ability&nbsp;to&nbsp;do&nbsp;spatial&nbsp;queries&nbsp;to&nbsp;the&nbsp;StyledFeatureLayer?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;help&nbsp;and&nbsp;time,&nbsp;  
&nbsp;&nbsp;  
&nbsp;.Ryan.

---

<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:** [June 4, 2009, 8:46pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/4 "2009-06-04T20:46:49Z")

</div>

Ryan,&nbsp;you&nbsp;are&nbsp;welcome.&nbsp;

Try&nbsp;the&nbsp;following&nbsp;update&nbsp;one:  
`public class StyledFeatureLayer : FeatureLayer    {        private Dictionary<Feature, Style> features;        public StyledFeatureLayer()            :this(new Dictionary<Feature,Style>())        { }        public StyledFeatureLayer(Dictionary<Feature, Style> features)            :base()        {            this.features = features;            FeatureSource = new InMemoryFeatureSource(new Collection<FeatureSourceColumn>(), features.Keys);        }        public Dictionary<Feature, Style> Features        {            get { return features; }        }        protected override bool IsOpenCore        {            get            {                return true;            }        }        protected override void SetupToolsCore()        {            base.SetupToolsCore();            FeatureSource = new InMemoryFeatureSource(new Collection<FeatureSourceColumn>(), features.Keys);        }        protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)        {            Collection<SimpleCandidate> labelInThisLayer = new Collection<SimpleCandidate>();            Collection<SimpleCandidate> labelInAllLayers = new Collection<SimpleCandidate>();            foreach (Feature feature in features.Keys)            {                Style style = features[feature];                style.Draw(new Feature[] { feature }, canvas, labelInThisLayer, labelInAllLayers);            }        }    }Test codes:private void Form1_Load(object sender, EventArgs e)        {            winformsMap1.MapUnit = GeographyUnit.Meter;            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);            winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.Default;            StyledFeatureLayer styledFeatureLayer = new StyledFeatureLayer();            BaseShape rectangle1 = new RectangleShape(0, 45, 45, 0);            Feature feature1 = new Feature(rectangle1);            BaseShape rectangle2 = new EllipseShape(new PointShape(45, 45), 5);            Feature feature2 = new Feature(rectangle2);            LineShape line1 = new LineShape();            line1.Vertices.Add(new Vertex(0, 0));            line1.Vertices.Add(new Vertex(45, 0));            line1.Vertices.Add(new Vertex(0, 45));            Feature feature3 = new Feature(line1);            styledFeatureLayer.Features.Add(feature1, AreaStyles.Country1);            styledFeatureLayer.Features.Add(feature2, AreaStyles.Grass1);            styledFeatureLayer.Features.Add(feature3, LineStyles.Canal1);            InMemoryFeatureLayer rectangleLayer = new InMemoryFeatureLayer();            rectangleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(new GeoColor(50, 100, 100, 200)));            rectangleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.DarkBlue;            rectangleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;            rectangleLayer.InternalFeatures.Add("Rectangle", new Feature("POLYGON((-100 -20,-100 200,50 200,50 -20,-100 -20))", "Rectangle"));            InMemoryFeatureLayer spatialQueryResultLayer = new InMemoryFeatureLayer();            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(200, GeoColor.SimpleColors.PastelRed)));            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red;            spatialQueryResultLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;            LayerOverlay staticOverlay = new LayerOverlay();            staticOverlay.Layers.Add("WorldLayer", styledFeatureLayer);            staticOverlay.Layers.Add("RectangleLayer", rectangleLayer);            LayerOverlay spatialQueryResultOverlay = new LayerOverlay();            spatialQueryResultOverlay.Layers.Add("SpatialQueryResultLayer", spatialQueryResultLayer);            winformsMap1.Overlays.Add(staticOverlay);            winformsMap1.Overlays.Add("SpatialQueryResultOverlay", spatialQueryResultOverlay);            winformsMap1.Refresh();        }        private void button1_Click(object sender, EventArgs e)        {            StyledFeatureLayer worldLayer = (StyledFeatureLayer)winformsMap1.FindFeatureLayer("WorldLayer");            InMemoryFeatureLayer rectangleLayer = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("RectangleLayer");            InMemoryFeatureLayer spatialQueryResultLayer = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("SpatialQueryResultLayer");            Feature rectangleFeature = rectangleLayer.InternalFeatures["Rectangle"];            Collection<Feature> spatialQueryResults;            worldLayer.Open();            string text = "Intersecting";            switch (text)            {                case "Within":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesWithin(rectangleFeature, new string[0]);                    break;                case "Containing":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesContaining(rectangleFeature, new string[0]);                    break;                case "Disjointed":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesDisjointed(rectangleFeature, new string[0]);                    break;                case "Intersecting":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesIntersecting(rectangleFeature, new string[0]);                    break;                case "Overlapping":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesOverlapping(rectangleFeature, new string[0]);                    break;                case "TopologicalEqual":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesTopologicalEqual(rectangleFeature, new string[0]);                    break;                case "Touching":                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesTouching(rectangleFeature, new string[0]);                    break;                default:                    spatialQueryResults = worldLayer.QueryTools.GetFeaturesWithin(rectangleFeature, new string[0]);                    break;            }            worldLayer.Close();            winformsMap1.Overlays["SpatialQueryResultOverlay"].Lock.EnterWriteLock();            try            {                spatialQueryResultLayer.InternalFeatures.Clear();                foreach (Feature feature in spatialQueryResults)                {                    spatialQueryResultLayer.InternalFeatures.Add(feature.Id, feature);                }            }            finally            {                winformsMap1.Overlays["SpatialQueryResultOverlay"].Lock.ExitWriteLock();            }            winformsMap1.Refresh();        }`  
Hope&nbsp;this&nbsp;can&nbsp;gives&nbsp;you&nbsp;any&nbsp;help.&nbsp;Let&nbsp;me&nbsp;know&nbsp;if&nbsp;any&nbsp;more&nbsp;queries.  
Thanks.  
&nbsp;  
Yale

---

<div class="post-metadata">

**Author:** ![Chad](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://community.thinkgeo.com/u/Chad)\
**Post date:** [August 24, 2009, 2:51pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/5 "2009-08-24T14:51:46Z")

</div>

Is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;use&nbsp;the&nbsp;above&nbsp;sample&nbsp;to&nbsp;have&nbsp;column&nbsp;values&nbsp;assigned&nbsp;to&nbsp;a&nbsp;feature&nbsp;in&nbsp;addition&nbsp;to&nbsp;a&nbsp;unique&nbsp;style?&nbsp;&nbsp;I've&nbsp;tried&nbsp;implementing&nbsp;this&nbsp;sample&nbsp;by&nbsp;overriding&nbsp;InMemoryFeatureLayer&nbsp;instead&nbsp;of&nbsp;FeatureLayer&nbsp;so&nbsp;I&nbsp;could&nbsp;specify&nbsp;custom&nbsp;columns.&nbsp;&nbsp;I&nbsp;then&nbsp;add&nbsp;features&nbsp;to&nbsp;the&nbsp;Features&nbsp;collection&nbsp;with&nbsp;ColumnValues&nbsp;data&nbsp;and&nbsp;a&nbsp;style.&nbsp;&nbsp;When&nbsp;I&nbsp;do&nbsp;a&nbsp;spatial&nbsp;query&nbsp;the&nbsp;features&nbsp;are&nbsp;returned&nbsp;but&nbsp;the&nbsp;ColumnValues&nbsp;data&nbsp;is&nbsp;not.&nbsp;&nbsp;It&nbsp;seems&nbsp;as&nbsp;though&nbsp;you&nbsp;need&nbsp;to&nbsp;add&nbsp;features&nbsp;to&nbsp;the&nbsp;InternalFeatures&nbsp;collection&nbsp;in&nbsp;order&nbsp;to&nbsp;have&nbsp;data&nbsp;returned&nbsp;in&nbsp;a&nbsp;query,&nbsp;but&nbsp;then&nbsp;I&nbsp;cannot&nbsp;specify&nbsp;a&nbsp;style&nbsp;for&nbsp;each&nbsp;feature.&nbsp;&nbsp;It&nbsp;would&nbsp;be&nbsp;nice&nbsp;if&nbsp;I&nbsp;could&nbsp;override&nbsp;the&nbsp;Feature&nbsp;object&nbsp;to&nbsp;add&nbsp;a&nbsp;Style&nbsp;property&nbsp;to&nbsp;it,&nbsp;but&nbsp;it&nbsp;seems&nbsp;to&nbsp;be&nbsp;a&nbsp;sealed&nbsp;class&nbsp;so&nbsp;it's&nbsp;not&nbsp;allowed.&nbsp;&nbsp;I've&nbsp;read&nbsp;that&nbsp;there&nbsp;is&nbsp;going&nbsp;to&nbsp;be&nbsp;a&nbsp;MapShapeLayer&nbsp;type&nbsp;of&nbsp;class&nbsp;in&nbsp;a&nbsp;future&nbsp;release,&nbsp;which&nbsp;I&nbsp;assume&nbsp;will&nbsp;support&nbsp;having&nbsp;data&nbsp;associated&nbsp;with&nbsp;the&nbsp;featues&nbsp;in&nbsp;the&nbsp;layer&nbsp;as&nbsp;well.&nbsp;&nbsp;Does&nbsp;anyone&nbsp;know&nbsp;of&nbsp;a&nbsp;workaround&nbsp;until&nbsp;this&nbsp;feature&nbsp;is&nbsp;released?&nbsp;Thanks&nbsp;in&nbsp;advance.

---

<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:** [August 25, 2009, 12:31am UTC](https://community.thinkgeo.com/t/mapshape-features/456/6 "2009-08-25T00:31:49Z")

</div>

Chad,

Thanks&nbsp;for&nbsp;your&nbsp;post!  
&nbsp;  
Which&nbsp;version&nbsp;of&nbsp;Desktop&nbsp;Edition&nbsp;you&nbsp;are&nbsp;trying&nbsp;to&nbsp;use?&nbsp;And&nbsp;can&nbsp;you&nbsp;send&nbsp;me&nbsp;you&nbsp;code&nbsp;showing&nbsp;your&nbsp;problem?&nbsp;I&nbsp;am&nbsp;a&nbsp;bit&nbsp;confused&nbsp;what&nbsp;is&nbsp;going&nbsp;on.  
&nbsp;  
Besides,&nbsp;we&nbsp;have&nbsp;a&nbsp;demonstration&nbsp;sample&nbsp;in&nbsp;following&nbsp;to&nbsp;show&nbsp;MapShapes:  
[code.thinkgeo.com/projects/show/mapshapes](http://code.thinkgeo.com/projects/show/mapshapes)  
&nbsp;  
Feel&nbsp;free&nbsp;let&nbsp;me&nbsp;know&nbsp;if&nbsp;any&nbsp;more&nbsp;questions.  
&nbsp;  
Thanks.  
&nbsp;  
Yale  
&nbsp;

---

<div class="post-metadata">

**Author:** ![Chad](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://community.thinkgeo.com/u/Chad)\
**Post date:** [August 25, 2009, 10:59am UTC](https://community.thinkgeo.com/t/mapshape-features/456/7 "2009-08-25T10:59:29Z")

</div>

I&nbsp;attached&nbsp;my&nbsp;code&nbsp;in&nbsp;the&nbsp;file.&nbsp;&nbsp;I&nbsp;grouped&nbsp;the&nbsp;pertinent&nbsp;classes&nbsp;together&nbsp;in&nbsp;the&nbsp;single&nbsp;file.

I'm&nbsp;trying&nbsp;to&nbsp;extend&nbsp;he&nbsp;MapShapes&nbsp;sample&nbsp;project&nbsp;code&nbsp;by&nbsp;attaching&nbsp;data&nbsp;to&nbsp;the&nbsp;shapes&nbsp;as&nbsp;well&nbsp;as&nbsp;unique&nbsp;styles.

In&nbsp;my&nbsp;code&nbsp;you&nbsp;should&nbsp;see&nbsp;from&nbsp;my&nbsp;comments&nbsp;that&nbsp;I'm&nbsp;now&nbsp;able&nbsp;to&nbsp;get&nbsp;column&nbsp;data&nbsp;right&nbsp;after&nbsp;populating&nbsp;the&nbsp;custom&nbsp;layer.&nbsp;&nbsp;But,&nbsp;when&nbsp;I&nbsp;try&nbsp;to&nbsp;get&nbsp;the&nbsp;data&nbsp;later&nbsp;outside&nbsp;of&nbsp;the&nbsp;initial&nbsp;layer&nbsp;setup&nbsp;I&nbsp;don't&nbsp;get&nbsp;data&nbsp;back.

Hopefully&nbsp;you&nbsp;can&nbsp;understand&nbsp;what&nbsp;I'm&nbsp;doing&nbsp;from&nbsp;the&nbsp;code.&nbsp;&nbsp;Thanks,

Chad

---

<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:** [August 25, 2009, 10:34pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/8 "2009-08-25T22:34:03Z")

</div>

Chad,

I&nbsp;think&nbsp;there&nbsp;are&nbsp;some&nbsp;very&nbsp;minor&nbsp;mistakes&nbsp;in&nbsp;your&nbsp;layer.&nbsp;Please&nbsp;try&nbsp;the&nbsp;new&nbsp;codes&nbsp;in&nbsp;attachment.  
&nbsp;  
Let&nbsp;me&nbsp;know&nbsp;if&nbsp;any&nbsp;more&nbsp;questions.  
&nbsp;  
Thanks.  
&nbsp;  
Yale  
  
[1101-MyMemoryLayer.cs](https://community.thinkgeo.com/uploads/default/original/2X/7/7703db76ad36ae7a1e268a4529acf5a1afa06672.cs) (6.21 KB)

---

<div class="post-metadata">

**Author:** ![Chad](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/ecccb3/32.png) [@Chad](https://community.thinkgeo.com/u/Chad)\
**Post date:** [August 31, 2009, 12:51pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/9 "2009-08-31T12:51:03Z")

</div>

Yale,

Sorry&nbsp;for&nbsp;the&nbsp;late&nbsp;reply.&nbsp;&nbsp;Your&nbsp;code&nbsp;fixed&nbsp;me!&nbsp;&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;help.

Chad

---

<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:** [August 31, 2009, 10:10pm UTC](https://community.thinkgeo.com/t/mapshape-features/456/10 "2009-08-31T22:10:06Z")

</div>

Chad,&nbsp;it&nbsp;is&nbsp;my&nbsp;pleasure!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;
