This project has moved and is read-only. For the latest updates, please go here.

Thematics Question

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Jan 4, 2016 at 9:01 AM
Hi Team,
As it is very general question that Explained below:-
Quest:-1 I am using a OGRProvider to read MapinfoFiles. and if i open those files without any custom theme they will appear on screen in very small time. but after applying custom theme the map tooks lots of time to render those mapinfo layers.
As after aply custom theme it will lots of time to come to sutom theme function in debug mode.

Quest:-2 My problem is that I need to open very large Mapinfo Files but without affecting my tools performmance.
as if i store all data of tab file to some Class objects or some datatables they will take me to Memory issue which corrsponds to 1000MB for 120MB mapinfo Tab file.
which is the best way to open Mapinfo Tab file on Sharmap from which i can query data Also..

As my product is ready but only issue is take lots of time to render MapInfo Files.

Jan 5, 2016 at 8:12 PM
If you don't apply theming, all attribute data is ignored and just the geometries are loaded.
On the other hand, if you apply theming, the attribute data is read as well. This is always more expensive than just geometries.
Can you share the code of the custom theme?

If you load your 120 MB MapInfo File into a FeatureDataTable that takes 1 GB in Memory, is that what you are saying?
Jan 6, 2016 at 6:57 AM
yes my question is same if i load 120 MB MapinfoFile into FeatureDataTable that takes 1GB Memory.

Code for Custom theme:-
            if (mpLayer.dtLegends != null && mpLayer._isEvent != true)
                if (mpLayer.LegendType == LegendType.Unique)
                    DataRow[] drcoll = mpLayer.dtLegends.Select(mpLayer.dtLegendColumn + " = " + Convert.ToString(row.ItemArray[row.Table.Columns.IndexOf(mpLayer.dtLegendColumn)]));
                    if (drcoll.Count() > 0)
                        style.PointColor = new SolidBrush(ColorTranslator.FromHtml(Convert.ToString(drcoll[0]["ColorVal"])));

Jan 7, 2016 at 9:46 PM
The code seems pretty expensive to me.
Is there a way you can calculate the column index beforehand? Also you keep creating solid brushes by translating a color val. It might be better to store those brushes in a dictionary<string, brush> and only create a new brush if no one for color val has been created. This helps you save memory as you limit the number of brushes that need to be created.