# USA Census Regions - data visualization

**URL:** <https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842>\
**Category:** WebForms\
**Created:** [May 31, 2011, 12:41pm UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842 "2011-05-31T12:41:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Savy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c6cbf5/32.png) [@Savy](https://community.thinkgeo.com/u/Savy)\
**Post date:** [May 31, 2011, 12:41pm UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/1 "2011-05-31T12:41:47Z")

</div>

Hi

I&nbsp;have&nbsp;a&nbsp;need&nbsp;for&nbsp;data&nbsp;visualization&nbsp;in&nbsp;&nbsp;USA&nbsp;Map&nbsp;which&nbsp;shows&nbsp;census&nbsp;regions

1.&nbsp;&nbsp;I&nbsp;need&nbsp;to&nbsp;show&nbsp;the&nbsp;map&nbsp;as&nbsp;shown&nbsp;in&nbsp;the&nbsp;link&nbsp;below&nbsp;[i-italy.org/files/55imag...isions.png](http://www.i-italy.org/files/55image/where%20we%20live/US%20Census%20Regions%20and%20Divisions.png)

2.&nbsp;I&nbsp;need&nbsp;to&nbsp;have&nbsp;labels&nbsp;for&nbsp;the&nbsp;North&nbsp;East&nbsp;States&nbsp;with&nbsp;arrows&nbsp;shown&nbsp;similiar&nbsp;to&nbsp;the&nbsp;link&nbsp;above.

3.&nbsp;I&nbsp;need&nbsp;to&nbsp;also&nbsp;show&nbsp;the&nbsp;U.S&nbsp;territories&nbsp;like&nbsp;Puerto&nbsp;Rico&nbsp;and&nbsp;Virgin&nbsp;Islands&nbsp;

&nbsp;

How&nbsp;can&nbsp;I&nbsp;accomplish&nbsp;this&nbsp;where&nbsp;the&nbsp;regions&nbsp;are&nbsp;seperated&nbsp;by&nbsp;an&nbsp;offset&nbsp;as&nbsp;shown&nbsp;in&nbsp;the&nbsp;link&nbsp;above&nbsp;.

---

<div class="post-metadata">

**Author:** ![Jack](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@Jack](https://community.thinkgeo.com/u/Jack)\
**Post date:** [May 31, 2011, 3:56pm UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/2 "2011-05-31T15:56:20Z")

</div>

&nbsp;

Hi&nbsp;Savy,

&nbsp;

There&nbsp;are&nbsp;a&nbsp;coup&nbsp;of&nbsp;ways&nbsp;to&nbsp;accomplish&nbsp;the&nbsp;1#&nbsp;and&nbsp;3#&nbsp;questions.&nbsp;But&nbsp;first&nbsp;you&nbsp;need&nbsp;some&nbsp;definitions&nbsp;on&nbsp;each&nbsp;state&nbsp;to&nbsp;identify&nbsp;the&nbsp;region,&nbsp;and&nbsp;have&nbsp;an&nbsp;“offset&nbsp;table”&nbsp;for&nbsp;each&nbsp;region.&nbsp;

Then&nbsp;Create&nbsp;a&nbsp;OffsetInmemoryLayer&nbsp;inherent&nbsp;from&nbsp;InmemoryFeatureLayer&nbsp;.&nbsp;

`        public class OffsetInmemoryLayer : InMemoryFeatureLayer        {            private double xOffset = 0;            private double yOffset = 0;            private GeoCollection<Feature> originalFeatures = null ;            public OffsetInmemoryLayer(double xOffset, double yOffset)            {                this.xOffset = xOffset;                this.yOffset = yOffset;                originalFeatures = new GeoCollection<Feature>();            }            protected override void DrawCore(GeoCanvas canvas, Collection<SimpleCandidate> labelsInAllLayers)            {                originalFeatures.Clear();                foreach (Feature feature in InternalFeatures)                {                    originalFeatures.Add(feature);                }                InternalFeatures.Clear();                foreach (Feature feature in originalFeatures)                {                    // TODO do the offset here                    InternalFeatures.Add(feature);                }                base.DrawCore(canvas, labelsInAllLayers);            }        }`

&nbsp;

&nbsp;

I&nbsp;have&nbsp;an&nbsp;idea&nbsp;for&nbsp;the&nbsp;2#&nbsp;question,&nbsp;but&nbsp;the&nbsp;logic&nbsp;may&nbsp;be&nbsp;a&nbsp;little&nbsp;bit&nbsp;complicate.&nbsp;

You&nbsp;can&nbsp;create&nbsp;your&nbsp;own&nbsp;TextStyle&nbsp;inherents&nbsp;from&nbsp;TextStyle&nbsp;and&nbsp;overwrite&nbsp;the&nbsp;DrawCore&nbsp;method.&nbsp;In&nbsp;the&nbsp;override&nbsp;method,&nbsp;calculate&nbsp;the&nbsp;Area&nbsp;of&nbsp;the&nbsp;Text&nbsp;to&nbsp;see&nbsp;it&nbsp;is&nbsp;out&nbsp;of&nbsp;the&nbsp;state&nbsp;or&nbsp;not.&nbsp;If&nbsp;it&nbsp;is&nbsp;then&nbsp;try&nbsp;to&nbsp;make&nbsp;it&nbsp;smaller.&nbsp;if&nbsp;it&nbsp;is&nbsp;still&nbsp;out&nbsp;of&nbsp;the&nbsp;state,&nbsp;add&nbsp;some&nbsp;offsets&nbsp;on&nbsp;the&nbsp;label&nbsp;and&nbsp;draw&nbsp;a&nbsp;line&nbsp;or&nbsp;arrow&nbsp;point&nbsp;to&nbsp;it.

&nbsp;

Thanks,

Lee

---

<div class="post-metadata">

**Author:** ![Savy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c6cbf5/32.png) [@Savy](https://community.thinkgeo.com/u/Savy)\
**Post date:** [June 1, 2011, 8:23am UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/3 "2011-06-01T08:23:33Z")

</div>

Hi&nbsp;Lee&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;response.&nbsp;&nbsp;&nbsp;  
&nbsp;First&nbsp;I&nbsp;tried&nbsp;to&nbsp;use&nbsp;a&nbsp;shape&nbsp;file&nbsp;editor&nbsp;and&nbsp;edit&nbsp;the&nbsp;states.shp&nbsp;file&nbsp;and&nbsp;make&nbsp;a&nbsp;new&nbsp;shape&nbsp;file&nbsp;with&nbsp;the&nbsp;map&nbsp;appropriately&nbsp;set&nbsp;for&nbsp;the&nbsp;regions.&nbsp;&nbsp;  
&nbsp;But&nbsp;I&nbsp;got&nbsp;into&nbsp;a&nbsp;problem&nbsp;with&nbsp;it&nbsp;when&nbsp;the&nbsp;MapEngine&nbsp;was&nbsp;trimmming&nbsp;off&nbsp;some&nbsp;polygons&nbsp;for&nbsp;whatever&nbsp;reason&nbsp;and&nbsp;not&nbsp;drawing&nbsp;some&nbsp;of&nbsp;them&nbsp;.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;needed&nbsp;to&nbsp;get&nbsp;the&nbsp;map&nbsp;all&nbsp;in&nbsp;an&nbsp;A4&nbsp;size&nbsp;paper&nbsp;for&nbsp;printing&nbsp;.&nbsp;So&nbsp;I&nbsp;thought&nbsp;of&nbsp;another&nbsp;alternative,&nbsp;I&nbsp;got&nbsp;an&nbsp;SVG&nbsp;file&nbsp;which&nbsp;has&nbsp;the&nbsp;image&nbsp;of&nbsp;the&nbsp;states&nbsp;and&nbsp;the&nbsp;territories&nbsp;sized&nbsp;appropriately.&nbsp;Is&nbsp;there&nbsp;a&nbsp;way&nbsp;for&nbsp;me&nbsp;to&nbsp;use&nbsp;this&nbsp;in&nbsp;a&nbsp;layer&nbsp;and&nbsp;process&nbsp;the&nbsp;map&nbsp;regions&nbsp;for&nbsp;adding&nbsp;a&nbsp;fill&nbsp;color&nbsp;.&nbsp;&nbsp;Or&nbsp;&nbsp;am&nbsp;I&nbsp;on&nbsp;my&nbsp;own&nbsp;for&nbsp;this&nbsp;kind&nbsp;of&nbsp;processing&nbsp;.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;&nbsp;  
&nbsp;Savy&nbsp;

---

<div class="post-metadata">

**Author:** ![Jack](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@Jack](https://community.thinkgeo.com/u/Jack)\
**Post date:** [June 1, 2011, 10:24am UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/4 "2011-06-01T10:24:03Z")

</div>

Hi&nbsp;Savy,&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;pre-process&nbsp;data&nbsp;is&nbsp;also&nbsp;a&nbsp;good&nbsp;idea&nbsp;and&nbsp;I&nbsp;believe&nbsp;it&nbsp;enhances&nbsp;the&nbsp;performance&nbsp;as&nbsp;well.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Could&nbsp;you&nbsp;send&nbsp;us&nbsp;the&nbsp;code&nbsp;as&nbsp;well&nbsp;as&nbsp;the&nbsp;data&nbsp;to&nbsp;trim&nbsp;off&nbsp;the&nbsp;polygon&nbsp;you&nbsp;are&nbsp;using?&nbsp;That&nbsp;will&nbsp;help&nbsp;and&nbsp;speed&nbsp;up&nbsp;a&nbsp;lot&nbsp;to&nbsp;find&nbsp;the&nbsp;problem.&nbsp;Also&nbsp;I&nbsp;am&nbsp;doing&nbsp;some&nbsp;investigation&nbsp;on&nbsp;the&nbsp;SVG&nbsp;file&nbsp;to&nbsp;see&nbsp;what&nbsp;we&nbsp;can&nbsp;do&nbsp;on&nbsp;it.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Lee&nbsp;

---

<div class="post-metadata">

**Author:** ![Jack](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@Jack](https://community.thinkgeo.com/u/Jack)\
**Post date:** [June 1, 2011, 11:26am UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/5 "2011-06-01T11:26:47Z")

</div>

Savy,

After&nbsp;doing&nbsp;research&nbsp;I&nbsp;find&nbsp;the&nbsp;SVG&nbsp;data&nbsp;specification&nbsp;from&nbsp;[w3.org/TR/SVG/](http://www.w3.org/TR/SVG/)&nbsp;.  
We&nbsp;can&nbsp;create&nbsp;SVGFeatureSource&nbsp;inherent&nbsp;from&nbsp;FeatureSource&nbsp;to&nbsp;read&nbsp;data&nbsp;from&nbsp;SVG&nbsp;file,&nbsp;and&nbsp;SVGFeatureLayer&nbsp;inherent&nbsp;from&nbsp;FeatureLayer&nbsp;to&nbsp;render.&nbsp;Then&nbsp;you&nbsp;can&nbsp;easily&nbsp;specify&nbsp;the&nbsp;styles&nbsp;you&nbsp;want.

`public class SVGFeatureSource : FeatureSource        {            private string pathFilename = "";                        public SVGFeatureSource(string pathFilename)            {                this.pathFilename = pathFilename;            }            protected override Collection<Feature> GetAllFeaturesCore(IEnumerable<string> returningColumnNames)            {                // Load features from the SVG file                throw new NotImplementedException();            }        }        public class SVGFeatureLayer : FeatureLayer        {            public SVGFeatureLayer(string pathFilename)            {                FeatureSource = new SVGFeatureSource(pathFilename );            }        }`

Thanks,  
Lee

---

<div class="post-metadata">

**Author:** ![Savy](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c6cbf5/32.png) [@Savy](https://community.thinkgeo.com/u/Savy)\
**Post date:** [June 1, 2011, 11:49am UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/6 "2011-06-01T11:49:41Z")

</div>

Hi&nbsp;Lee&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;response&nbsp;.&nbsp;&nbsp;Seems&nbsp;like&nbsp;that&nbsp;is&nbsp;a&nbsp;good&nbsp;option.&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Savy

---

<div class="post-metadata">

**Author:** ![Jack](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/j/cc9497/32.png) [@Jack](https://community.thinkgeo.com/u/Jack)\
**Post date:** [June 1, 2011, 2:00pm UTC](https://community.thinkgeo.com/t/usa-census-regions-data-visualization/5842/7 "2011-06-01T14:00:16Z")

</div>

Feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know&nbsp;if&nbsp;there&nbsp;are&nbsp;any&nbsp;questions&nbsp;you&nbsp;have.&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;Lee
