ThinkGeo.com    |     Documentation    |     Premium Support

Slow performance loading thousands of points

I’m loading in a bunch of points (little over 4000) from a spatial table in a ms sql database. I noticed it takes a bit of time to display on the map. Is there a way to increase performance of doing this? Relevant code is below:

string connectionString = "Server=****;Database=****;User ID=****Password=****";
MsSqlFeatureLayer sqlLayer = new MsSqlFeatureLayer(connectionString, "****", "objectid");
sqlLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Cross, GeoColor.SimpleColors.Red, 2);
sqlLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

worldOverlay.Layers.Add(sqlLayer);

Note: I have 8 other layers in the worldOverlay. A few shape file layers, a personalgeodatabase layer, and an inmemoryfeature layer.

Thanks!

Hi Dan,

I don’t think you need to display thousands points at the same time, because that will looks bad.

I think you can do something to solve this problem:

  1. Create index file for your data source

  2. Open cache if your render style won’t always get refresh

  3. Show correct shapes in specified extent, that means you can modify the render logic to avoid show too many points at the same time. You can view our code for old WorldMapKit, it render so many shapes and the speed still be fast. You can find the project here now: https://github.com/ThinkGeo/WorldStreetsLayerSDKOnWindows-ForWinForms

Wish that’s helpful.

Regards,

Ethan

Thanks for the response!

Tried creating an index file with the BuildIndex function on the sqlLayer, but that just made my map appear blank.

Maybe you could help me get this cache working properly, I’m sort of confused how it works. I followed the example in the “HowDoI” project by doing this:

FileBitmapTileCache bitmapTileCache = new FileBitmapTileCache();
bitmapTileCache.CacheDirectory = @"...\AppData\SampleCacheTiles";
bitmapTileCache.CacheId = "World02CachedTiles";
bitmapTileCache.TileAccessMode = TileAccessMode.ReadOnly;
bitmapTileCache.ImageFormat = TileImageFormat.Png;
worldOverlay.TileCache = bitmapTileCache;
worldOverlay.TransitionEffect = TransitionEffect.None;

But I didn’t notice a difference and didn’t see anything being placed in the “SampleCacheTiles” folder when the map was loaded. I’m not positive but I think all the points do need to be shown, but I will double check.

Hi Dan,

  1. I tested the mssql.BuildIndex(BuildIndexMode.DoNotRebuild); works well in my test sample.

  2. For cache, please comment this line: bitmapTileCache.TileAccessMode = TileAccessMode.ReadOnly; Which means your application only read existing cache but not generate cache images, that’ not suitable for your scenario.

Wish that’s helpful.

Regards,

Ethan