Hello,
I would like get your opinions and suggestions on how to optimize the structure of shape files to achieve maximum possible performance in rendering the map.
My case is as follows :
I have the map data for the whole country. But, it is not a big file including everything, instead roads (as polylines) for each city has its own shape file. Also, the shapefile data has something like the following structure.
City01_Roads.shp, City02_Roads.shp, City03_Roads.shp etc.
ID (int), Feature Name (string), Road Type (string), etc...
123, Backway Street, Street
125, Trueway Street, Street
190, Marvin Avenue, Avenue
213, Sunset Boulevard, Boulevard
233, E-66 Highway, Highway
356, Friday 13th Highway, Highway
So I have a ValueStyle to render these according to the road type. Also, zoomlevels are adjusted as to show only relevant types of roads according to zoomlevel.
Something like the following code is used (First time trying to use the source code feature, hope it will show up well) :
ShapeFileFeatureLayer roadLayer = new ShapeFileFeatureLayer(MapPath("~/App_Data/City34_road.shp"));
roadLayer.RequireIndex = true;
roadLayer.DrawingMarginPercentage = 50;
// Zoom level 01-12
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "TIPI"; // Road type
valueStyle.ValueItems.Add(new ValueItem("Devlet Yolu", LineStyles.Highway1));
valueStyle.ValueItems.Add(new ValueItem("Otoyol", LineStyles.Highway1));
valueStyle.ValueItems.Add(new ValueItem("Otoyol Bağlantısı", LineStyles.Highway1));
valueStyle.ValueItems[0].DefaultLineStyle.InnerPen.Color = GeoColor.StandardColors.LightPink;
roadLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
roadLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level12;
// Zoom level 13-16
ValueStyle valueStyle2 = new ValueStyle();
valueStyle2.ColumnName = "TIPI";
valueStyle2.ValueItems.Add(new ValueItem("Cadde", LineStyles.LocalRoad2));
valueStyle2.ValueItems.Add(new ValueItem("Bulvar", LineStyles.Highway2));
valueStyle2.ValueItems.Add(new ValueItem("Devlet Yolu", LineStyles.Highway1));
valueStyle2.ValueItems.Add(new ValueItem("Otoyol", LineStyles.Highway1));
valueStyle2.ValueItems.Add(new ValueItem("Otoyol Bağlantısı", LineStyles.Highway1));
valueStyle2.ValueItems[3].DefaultLineStyle.InnerPen.Color = GeoColor.StandardColors.LightPink;
valueStyle2.ValueItems.Add(new ValueItem("İl Yolu", LineStyles.Interstate1));
roadLayer.ZoomLevelSet.ZoomLevel13.CustomStyles.Add(valueStyle2);
roadLayer.ZoomLevelSet.ZoomLevel13.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level16;
// Zoom level 17-20
ValueStyle valueStyle3 = new ValueStyle();
valueStyle3.ColumnName = "TIPI";
valueStyle3.ValueItems.Add(new ValueItem("Yol", LineStyles.LocalRoad3));
valueStyle3.ValueItems.Add(new ValueItem("Sokak", LineStyles.LocalRoad2));
valueStyle3.ValueItems.Add(new ValueItem("Cadde", LineStyles.LocalRoad2));
valueStyle3.ValueItems.Add(new ValueItem("Bulvar", LineStyles.Highway2));
valueStyle3.ValueItems.Add(new ValueItem("Devlet Yolu", LineStyles.Highway1));
valueStyle3.ValueItems.Add(new ValueItem("Otoyol", LineStyles.Highway1));
valueStyle3.ValueItems.Add(new ValueItem("Otoyol Bağlantısı", LineStyles.Highway1));
valueStyle3.ValueItems[4].DefaultLineStyle.InnerPen.Color = GeoColor.StandardColors.LightPink;
valueStyle3.ValueItems.Add(new ValueItem("İl Yolu", LineStyles.Interstate1));
valueStyle3.ValueItems.Add(new ValueItem("İç Yol", LineStyles.LocalRoad4));
roadLayer.ZoomLevelSet.ZoomLevel17.CustomStyles.Add(valueStyle3);
roadLayer.ZoomLevelSet.ZoomLevel17.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
mcTest.StaticOverlay.Layers.Add(roadLayer);
But these are quite big files and the biggest one has the following sizes
shp file : 25 MB
dbf file : 25 MB
shx file : 2 MB
prj file : 1 KB (this is constant anyway)
ids file : 4 MB
idx file : 25 MB
approximate number of features (polylines) : 250000
Total data set (excluding Map Suite index files) is about 550 MB.
I'm thinking of the following ways to use the data, but I have no idea which one would be better. I would have to spend less time on trial and error, if I could have some pointers here.
1) Use the shape files as they are. We have 81 cities, thus I would have 81 static feature layers. There would also be a few more layers for POIs or geographic features etc.
2) Concatenate all the cities into one big Country.shp file.
3) Concatenate all the cities into one big Country.shp file. Then, from this data, create a layer for each type of road. Such as Country_streets.shp, Country_highways.shp etc. and load them as feature layers.
4) Something else ???
Best regards,
Hakan Çelik