ThinkGeo.com    |     Documentation    |     Premium Support

Building index for layers on background thread

Some indexes take awhile to build for certain layers I’m loading, mainly large shapefiles and nautical chart layers. I’d like to move these to a different thread using something like:

Task.Run(() => { NauticalChartsFeatureLayer.BuildIndexFile(filePath, BuildIndexMode.DoNotRebuild); });

However, I noticed the app crashes if the map does any kind of refresh before the index file is built when using the above method.

How exactly is the index file for layers used? Does the layer read from it every time the map is refreshed?

My goal is to have the users still be able to pan/zoom the layer while the index is being built, and then hopefully see a performance increase after the index is finished building.

Thanks!

Hi Dan,

In fact our developer just handled the index build logic for Nautical Charts, you should want to try this version: https://www.nuget.org/packages/ThinkGeo.MapSuite.Layers.NauticalCharts/11.0.0-beta012

The speed get faster when build index, you can find more detail information from this topic: Nautical Chart Indexes

The index file will be used each time you get data from your data source, the index is help you quickly get necessary source, so when you refresh or pan or zoom, it is required.

And if your index file hadn’t built succeed, you can set “RequireIndex” equal false to shape file, then shape file will be rendered slower, but for NauticalChartsFeatureLayer you cannot do that, it looks the index file is necessary.

I think you should need build index for NauticalChartsLayer background, and after it is generated, you can tell user this layer is ready to be render.

Wish that’s helpful.

Regards,

Ethan