# Shape layer won't show on map

**URL:** <https://community.thinkgeo.com/t/shape-layer-wont-show-on-map/3942>\
**Category:** WPF\
**Created:** [February 22, 2016, 2:35pm UTC](https://community.thinkgeo.com/t/shape-layer-wont-show-on-map/3942 "2016-02-22T14:35:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@Kevin6](https://community.thinkgeo.com/u/Kevin6)\
**Post date:** [February 22, 2016, 2:35pm UTC](https://community.thinkgeo.com/t/shape-layer-wont-show-on-map/3942/1 "2016-02-22T14:35:44Z")

</div>

Hi,&nbsp;I’ve&nbsp;got&nbsp;some&nbsp;shape&nbsp;files&nbsp;which&nbsp;load&nbsp;fine&nbsp;and&nbsp;other&nbsp;which&nbsp;don’t&nbsp;error&nbsp;out&nbsp;when&nbsp;loading&nbsp;but&nbsp;simply&nbsp;do&nbsp;not&nbsp;show&nbsp;up&nbsp;on&nbsp;the&nbsp;map.&nbsp;When&nbsp;&nbsp;I&nbsp;load&nbsp;those&nbsp;shape&nbsp;files&nbsp;in&nbsp;external&nbsp;tools&nbsp;like&nbsp;mapshaper.org&nbsp;or&nbsp;QGis&nbsp;they&nbsp;load&nbsp;fine&nbsp;and&nbsp;look&nbsp;as&nbsp;I&nbsp;expect&nbsp;them&nbsp;to&nbsp;look.&nbsp;They&nbsp;are&nbsp;some&nbsp;of&nbsp;the&nbsp;simpler&nbsp;shape&nbsp;files&nbsp;we&nbsp;have&nbsp;so&nbsp;it&nbsp;really&nbsp;confuses&nbsp;me&nbsp;why&nbsp;much&nbsp;larger&nbsp;ones&nbsp;load&nbsp;and&nbsp;these&nbsp;ones&nbsp;don’t.&nbsp;  
  
  
  
Code&nbsp;to&nbsp;create&nbsp;shape&nbsp;layer&nbsp;and&nbsp;set&nbsp;projection&nbsp;on&nbsp;it.&nbsp;I’ve&nbsp;attached&nbsp;a&nbsp;zip&nbsp;with&nbsp;the&nbsp;shape&nbsp;file&nbsp;which&nbsp;is&nbsp;pretty&nbsp;basic.&nbsp;If&nbsp;anyone&nbsp;can&nbsp;help&nbsp;I&nbsp;would&nbsp;greatly&nbsp;appreciate&nbsp;it.&nbsp;

> `01.``var shapeLocation = @``"C:\Users\Kevin.IWS.000\AppData\Local\Temp\Falcon32015\SavedMaps\55697\55697-new.shp"``;`  
> `02.``ShapeFileFeatureLayer.BuildIndexFile(shapeLocation, BuildIndexMode.Rebuild);`  
> `03.``ShapeFileFeatureLayer shapeLayer = ``new`&nbsp;`ShapeFileFeatureLayer(shapeLocation);`  
> `04.``shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle =  ``new`&nbsp;`LineStyle(``new`&nbsp;`GeoPen(GeoBrushes.PastelYellow));`  
> `05.`&nbsp;  
> `06.``Proj4Projection proj4 = ``new`&nbsp;`Proj4Projection();`  
> `07.``proj4.InternalProjectionParametersString = Proj4Projection.GetWgs84ParametersString();`  
> `08.``proj4.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();`  
> `09.`&nbsp;  
> `10.``shapeLayer.FeatureSource.Projection = proj4;`  
> `11.``shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;`

  
  
  
[55697.zip](https://community.thinkgeo.com/uploads/default/original/1X/736e4f0b2fa4af9c27b66c2621551432c7e5b47d.zip) (1.27 KB)

---

<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:** [February 23, 2016, 12:44am UTC](https://community.thinkgeo.com/t/shape-layer-wont-show-on-map/3942/2 "2016-02-23T00:44:47Z")

</div>

Hi&nbsp;Kevin,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;data&nbsp;and&nbsp;code.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Your&nbsp;shape&nbsp;won’t&nbsp;be&nbsp;shown&nbsp;mainly&nbsp;because&nbsp;it’s&nbsp;a&nbsp;area&nbsp;shape,&nbsp;but&nbsp;you&nbsp;only&nbsp;set&nbsp;the&nbsp;line&nbsp;style&nbsp;for&nbsp;layer.&nbsp;  
&nbsp;&nbsp;  
&nbsp;And&nbsp;if&nbsp;you&nbsp;set&nbsp;projection,&nbsp;you&nbsp;need&nbsp;choose&nbsp;mapunit&nbsp;equal&nbsp;meter&nbsp;and&nbsp;assign&nbsp;the&nbsp;correct&nbsp;extent&nbsp;for&nbsp;it.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Please&nbsp;see&nbsp;my&nbsp;test&nbsp;code&nbsp;as&nbsp;below,&nbsp;which&nbsp;render&nbsp;a&nbsp;polygon&nbsp;on&nbsp;map&nbsp;correct&nbsp;from&nbsp;your&nbsp;data.&nbsp;  
&nbsp;&nbsp;  
&nbsp;` private void WpfMap_Loaded(object sender, RoutedEventArgs e)        {            Map1.MapUnit = GeographyUnit.Meter;            string shapeLocation = @“D:\55697.shp”;            ShapeFileFeatureLayer.BuildIndexFile(shapeLocation, BuildIndexMode.Rebuild);            ShapeFileFeatureLayer shapeLayer = new ShapeFileFeatureLayer(shapeLocation);            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoBrushes.Red));            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;            shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle= PointStyles.Capital1;            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;            Proj4Projection proj4 = new Proj4Projection();            proj4.InternalProjectionParametersString = Proj4Projection.GetWgs84ParametersString();            proj4.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();            proj4.Open();            shapeLayer.FeatureSource.Projection = proj4;            shapeLayer.Open();            LayerOverlay overlay = new LayerOverlay();            overlay.Layers.Add(shapeLayer);            Map1.Overlays.Add(overlay);            Map1.CurrentExtent = shapeLayer.GetBoundingBox();            Map1.Refresh();        } `&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Kevin6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@Kevin6](https://community.thinkgeo.com/u/Kevin6)\
**Post date:** [February 23, 2016, 6:23am UTC](https://community.thinkgeo.com/t/shape-layer-wont-show-on-map/3942/3 "2016-02-23T06:23:39Z")

</div>

That&nbsp;worked!&nbsp;Thank&nbsp;you&nbsp;very&nbsp;much.&nbsp;I&nbsp;didn’t&nbsp;think&nbsp;about&nbsp;setting&nbsp;the&nbsp;area&nbsp;style.&nbsp;I&nbsp;had&nbsp;the&nbsp;correct&nbsp;extent&nbsp;and&nbsp;map&nbsp;unit&nbsp;set&nbsp;already&nbsp;but&nbsp;I&nbsp;was&nbsp;missing&nbsp;the&nbsp;area&nbsp;style.&nbsp;I&nbsp;appreciate&nbsp;the&nbsp;quick&nbsp;and&nbsp;accurate&nbsp;response.

---

<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:** [February 23, 2016, 9:14pm UTC](https://community.thinkgeo.com/t/shape-layer-wont-show-on-map/3942/4 "2016-02-23T21:14:30Z")

</div>

Hi&nbsp;Kevin,&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
