ThinkGeo.com    |     Documentation    |     Premium Support

InMemoryFeatureLayer with 5000 Features performance

I created an InMemoryFeatureLayer.
I added 5000 features to its InternalFeatures.
Each features is a PointShape with a single “Status” column of type PointType.Bitmap.

Using a DispatcherTimer i changed the feature status causing its bitmap to change.
I tried updating status for 1000 features every 1 second. i.e.

inMemoryFeatureLayer.Open();
inMemoryFeatureLayer.EditTools.BeginTransaction();
for 0 => 1000:
inMemoryFeatureLayer.EditTools.Update(pointShape);
inMemoryFeatureLayer.EditTools.CommitTransaction();
inMemoryFeatureLayer.Close();

I have noticed a significant delay in performance.
What will be the approach to improve that. My scenario can get up to 10,000 features.

Thnx
Offer

Hi Offer,

I think I recreated your issue, please set the TileType property in LayerOverlay which included the inMemoryFeatureLayer to “SingleTile”.

If I misunderstood anything, please provide more information.

Thanks,
Emil

Hi Emil.
Thank you for your reply

I already changed TileType to “SingleTile” and it did improved performance, still I am trying to improve it even more, for the refresh time for updating 1000 entities can get up to 1500 ms, depending on the current scale.

My main question is - Is there a dedicated infrastructure flow for a scenario as described? Does the InMemoryFeatureLayer is the most suitable layer to implement such a scenario, or can it be done using other MapSuiteCore objects?

Offer

Hi Offer,

The InMemoryFeatureLayer is the best choice I think, and we have some sample shows the scenario in our wiki or Product Center ( the samples named: Dynamic Marker Overlay, How Do I [Dynamic Shapes–>efficiently move a plane image] ), but i guess they not suitable for you, because they did not use too many feature.

Here are some point you can try:

A. We need to determine if too much time is spent in the process of update feature, please try the follow code snippets:

StopWatch sw = new Stopwatch();
sw.Start();
inMemoryFeatureLayer.Open();
inMemoryFeatureLayer.EditTools.BeginTransaction();
for 0 => 1000:
inMemoryFeatureLayer.EditTools.Update(pointShape);
inMemoryFeatureLayer.EditTools.CommitTransaction();
inMemoryFeatureLayer.Close();
sw.Stop();

if it takes too much time, we can create a new InMemoryFeatureLayer instead of update, please follow the code below:

inMemoryFeatureLayer.Open();
var allFeatures = inMemoryFeatureLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);
for 0=>1000
allFeatures[i].ColumnValues["Status"] = "xxx";
InMemoryFeatureLayer newInMemoryFeatureLayer = new InMemoryFeatureLayer(layer.GetColumns(), allFeatures);
newInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(xxxStyle);
newInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

By the way, the update process takes time is 50ms in my side.

B. If the update content is relatively fixed, I think we can use cache to improved performance.

C. I guess use the vector symbol point style can improve performance, please have a try with the following PointStyles:

    PointStyles.CreateSimplePointStyle(PointSymbolType.Triangle,GeoColor.SimpleColors.Black, GeoColor.SimpleColors.Blue, 1, 20);
    PointStyles.CreateSimplePointStyle(PointSymbolType.Cross, GeoColor.SimpleColors.Black, GeoColor.SimpleColors.Blue, 1, 20);

I guess we can create some custom symbol point style for your requirement, if necessary, please contact your sales for details

Attached is the sample Shows the tests I did, please check it out, and let me know whether it restore your scene very well. if not, please sharing more information, or upload a simple project to show us that and we can work based on it.
Wpf_InMemoryFeatureLayerPerformanceSample.zip (12.6 KB)
Thanks,
Emil