# WPF performance with shapefile

**URL:** <https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438>\
**Category:** WPF\
**Created:** [June 24, 2013, 5:48pm UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438 "2013-06-24T17:48:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Murray](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Murray](https://community.thinkgeo.com/u/Murray)\
**Post date:** [June 24, 2013, 5:48pm UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/1 "2013-06-24T17:48:30Z")

</div>

Hi&nbsp;  
  
  
  
I&nbsp;am&nbsp;getting&nbsp;very&nbsp;poor&nbsp;performance&nbsp;displaying&nbsp;a&nbsp;shapefile&nbsp;on&nbsp;top&nbsp;of&nbsp;a&nbsp;worldmaplayer.  
  
  
  
It&nbsp;takes&nbsp;many&nbsp;seconds&nbsp;to&nbsp;refresh&nbsp;when&nbsp;zooming&nbsp;and&nbsp;moving&nbsp;around.&nbsp;  
  
  
  
Basically&nbsp;it&nbsp;is&nbsp;unusable.  
  
  
  
I&nbsp;am&nbsp;hoping&nbsp;I&nbsp;am&nbsp;doing&nbsp;something&nbsp;wrong.  
  
  
  
The&nbsp;code&nbsp;I&nbsp;am&nbsp;using&nbsp;is&nbsp;below.  
  
  
  
The&nbsp;file&nbsp;is&nbsp;too&nbsp;large&nbsp;to&nbsp;post&nbsp;on&nbsp;this&nbsp;forum.&nbsp;But&nbsp;you&nbsp;can&nbsp;download&nbsp;it&nbsp;here  
  
[geodownloads.dmp.wa.gov.au/d…ntreDb.asp](http://geodownloads.dmp.wa.gov.au/datacentre/datacentreDb.asp)  
  
  
  
Under&nbsp;Statewide&nbsp;Spatial&nbsp;Datasets  
  
-&nbsp;Mineral&nbsp;Information  
  
-&nbsp;Tenements&nbsp;-&nbsp;Current&nbsp;(&nbsp;Live&nbsp;and&nbsp;Pending)  
  
-&nbsp;Download  
  
-&nbsp;Esri&nbsp;Shapefile  
  
  
  
Hopefully&nbsp;you&nbsp;can&nbsp;see&nbsp;the&nbsp;problem&nbsp;as&nbsp;this&nbsp;is&nbsp;a&nbsp;real&nbsp;issue&nbsp;for&nbsp;us  
  
  
  
regards  
  
  
  
Murray

> `var layer = ``new`&nbsp;`ShapeFileFeatureLayer(file);`  
> `        ``layer.RequireIndex = ``false``;`  
> `        ``layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;`  
> `        ``layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle =`  
> `            ``AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent,`  
> `                                             ``GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));`  
> &nbsp;  
> `        ``// Convert to the current map projection`  
> `        ``var proj = ``new`&nbsp;`Proj4Projection`  
> `            ``{`  
> `                ``InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326),`  
> `                ``ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(srid)`  
> `            ``};`  
> `        ``layer.FeatureSource.Projection = proj;`  
> `        ``proj.Open();`  
> `        ``_staticOverlay.Layers.Add(file,layer);`  
> 
> ``

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [June 25, 2013, 3:36am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/2 "2013-06-25T03:36:23Z")

</div>

Hi&nbsp;Murray,&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;sorry&nbsp;for&nbsp;the&nbsp;inconvenience,&nbsp;we&nbsp;tried&nbsp;to&nbsp;download&nbsp;the&nbsp;data&nbsp;from&nbsp;the&nbsp;link,&nbsp;but&nbsp;it&nbsp;couldn’t&nbsp;be&nbsp;open&nbsp;on&nbsp;our&nbsp;side,&nbsp;would&nbsp;you&nbsp;please&nbsp;send&nbsp;it&nbsp;to&nbsp;[forumsupport@thinkgeo.com](mailto:forumsupport@thinkgeo.com)?&nbsp;Once&nbsp;we&nbsp;get&nbsp;your&nbsp;data&nbsp;we&nbsp;will&nbsp;debug&nbsp;it&nbsp;immediately.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Waiting&nbsp;for&nbsp;your&nbsp;further&nbsp;information.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Summer

---

<div class="post-metadata">

**Author:** ![Murray](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Murray](https://community.thinkgeo.com/u/Murray)\
**Post date:** [June 26, 2013, 12:51am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/3 "2013-06-26T00:51:11Z")

</div>

Hi  
  
  
  
It&nbsp;has&nbsp;been&nbsp;emailed&nbsp;as&nbsp;requested

---

<div class="post-metadata">

**Author:** ![Murray](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Murray](https://community.thinkgeo.com/u/Murray)\
**Post date:** [June 26, 2013, 6:27pm UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/4 "2013-06-26T18:27:34Z")

</div>

This&nbsp;doesn’t&nbsp;seem&nbsp;to&nbsp;be&nbsp;restricted&nbsp;to&nbsp;shapefiles.  
  
  
  
I&nbsp;am&nbsp;having&nbsp;the&nbsp;same&nbsp;poor&nbsp;redraw&nbsp;on&nbsp;JP2&nbsp;files&nbsp;as&nbsp;well.  
  
  
  
Please&nbsp;let&nbsp;me&nbsp;know&nbsp;if&nbsp;you&nbsp;want&nbsp;me&nbsp;to&nbsp;send&nbsp;through&nbsp;one&nbsp;of&nbsp;those&nbsp;as&nbsp;well

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [June 27, 2013, 5:28am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/5 "2013-06-27T05:28:57Z")

</div>

Hi&nbsp;Murray,  
  
  
  
Thanks&nbsp;for&nbsp;your&nbsp;data,&nbsp;we&nbsp;have&nbsp;found&nbsp;two&nbsp;ways&nbsp;to&nbsp;speed&nbsp;it&nbsp;up,  
  
  
  
The&nbsp;first&nbsp;is&nbsp;to&nbsp;use&nbsp;build&nbsp;ShapeFileFeatureLayer.BuildIndexFile(shpPath,&nbsp;BuildIndexMode.DoNotRebuild)  
  
  
  
The&nbsp;Second&nbsp;is&nbsp;to&nbsp;use&nbsp;tilecache,&nbsp;attahced&nbsp;is&nbsp;the&nbsp;sample&nbsp;would&nbsp;you&nbsp;please&nbsp;try&nbsp;it?  
  
  
  
if&nbsp;you&nbsp;have&nbsp;any&nbsp;more&nbsp;question&nbsp;,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.  
  
  
  
Best&nbsp;Regards  
  
  
  
Summer  
  
[008\_007\_006\_005\_004\_003\_002\_001\_Sample.zip](https://community.thinkgeo.com/uploads/default/original/2X/d/db6eb268c5acfe80683eba1e357a16c0044db80d.zip) (10.4 KB)

---

<div class="post-metadata">

**Author:** ![Murray](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@Murray](https://community.thinkgeo.com/u/Murray)\
**Post date:** [June 27, 2013, 10:41pm UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/6 "2013-06-27T22:41:05Z")

</div>

Ok&nbsp;thanks&nbsp;that&nbsp;seems&nbsp;to&nbsp;have&nbsp;improved&nbsp;performance.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;will&nbsp;do&nbsp;more&nbsp;testing&nbsp;over&nbsp;a&nbsp;range&nbsp;of&nbsp;files,&nbsp;but&nbsp;it&nbsp;seems&nbsp;that&nbsp;has&nbsp;fixed&nbsp;it

---

<div class="post-metadata">

**Author:** ![Tomas\_P](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/9dc877/32.png) [@Tomas\_P](https://community.thinkgeo.com/u/Tomas_P)\
**Post date:** [June 28, 2013, 2:29am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/7 "2013-06-28T02:29:39Z")

</div>

Hi&nbsp;there:&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;have&nbsp;the&nbsp;same&nbsp;issues&nbsp;as&nbsp;Murray&nbsp;was&nbsp;posting,&nbsp;but&nbsp;I&nbsp;already&nbsp;had&nbsp;the&nbsp;TileCache&nbsp;and&nbsp;an&nbsp;index&nbsp;file&nbsp;for&nbsp;my&nbsp;shapefiles.&nbsp;  
&nbsp;By&nbsp;the&nbsp;way:&nbsp;what&nbsp;does&nbsp;the&nbsp;`BuildIndexMode.DoNotRebuild`&nbsp;in&nbsp;`ShapeFileFeatureLayer.BuildIndexFile(shpPath, BuildIndexMode.DoNotRebuild);`&nbsp;?&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;other&nbsp;idea&nbsp;about&nbsp;how&nbsp;to&nbsp;speedup&nbsp;this?&nbsp;  
&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks!

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [July 1, 2013, 12:59am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/8 "2013-07-01T00:59:22Z")

</div>

Hi&nbsp;Murray&nbsp;and&nbsp;Tomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Great&nbsp;to&nbsp;hear&nbsp;it&nbsp;helped&nbsp;Murray’s&nbsp;case&nbsp;and&nbsp;if&nbsp;you&nbsp;have&nbsp;any&nbsp;more&nbsp;question,&nbsp;please&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;us&nbsp;know.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Would&nbsp;Tomas&nbsp;please&nbsp;provide&nbsp;us&nbsp;your&nbsp;data&nbsp;for&nbsp;a&nbsp;further&nbsp;test,&nbsp;you&nbsp;could&nbsp;upload&nbsp;it&nbsp;here,&nbsp;or&nbsp;send&nbsp;it&nbsp;to&nbsp;[forumsupport@thinkgeo.com](mailto:forumsupport@thinkgeo.com)&nbsp;if&nbsp;it&nbsp;is&nbsp;confidential.Once&nbsp;we&nbsp;get&nbsp;your&nbsp;data,&nbsp;we&nbsp;will&nbsp;debug&nbsp;it&nbsp;immediately.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Best&nbsp;Regards&nbsp;  
&nbsp;&nbsp;  
&nbsp;Summer&nbsp;

---

<div class="post-metadata">

**Author:** ![Tomas\_P](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/t/9dc877/32.png) [@Tomas\_P](https://community.thinkgeo.com/u/Tomas_P)\
**Post date:** [July 1, 2013, 6:48am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/9 "2013-07-01T06:48:34Z")

</div>

Hi&nbsp;Summer:&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;will&nbsp;send&nbsp;you&nbsp;as&nbsp;soon&nbsp;as&nbsp;possible&nbsp;a&nbsp;sample&nbsp;code&nbsp;with&nbsp;this&nbsp;features.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thank&nbsp;you&nbsp;for&nbsp;your&nbsp;answers.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Tomás

---

<div class="post-metadata">

**Author:** ![Summer1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@Summer1](https://community.thinkgeo.com/u/Summer1)\
**Post date:** [July 2, 2013, 12:15am UTC](https://community.thinkgeo.com/t/wpf-performance-with-shapefile/3438/10 "2013-07-02T00:15:29Z")

</div>

Hi&nbsp;Tomas,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;the&nbsp;input,&nbsp;and&nbsp;we&nbsp;will&nbsp;be&nbsp;waiting&nbsp;for&nbsp;sample,&nbsp;and&nbsp;if&nbsp;possible&nbsp;would&nbsp;you&nbsp;please&nbsp;send&nbsp;the&nbsp;data&nbsp;together?&nbsp;we&nbsp;will&nbsp;make&nbsp;a&nbsp;futher&nbsp;investigation&nbsp;for&nbsp;it.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Best&nbsp;Regards&nbsp;  
&nbsp;&nbsp;  
&nbsp;Summer
