I am new to shapfiles and thinkGeo software. I am able to display the sample shapefiles on thinkGeo map tool. Artist gave me shapfile and it doesnt display original colors on thinkGeo aswell as in shafile Viwer. In shows the colors in his editor of shapefile creator. I have set the default areaStyle and zoomlevels. I am not sure if i am missing or Artist missing any? please help me to understand this. appreciate your help.
Lost Shapefile colors
Hello rajanikanth,
Welcome to thinkgeo, this is Gary, please feel free to let us know your questions.
For this question, I think you are using ShapeFileFeatureLayer, right? This layer is a static layer that can load shape file and get the features in it and display on the map, but for this purpose, you need set the styles to the layer to let map control knows what do you want the map looks like.
Please check the code below:
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.SimpleColors.Blue));
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
In this code, I set the line style to blue, so any line in this shape file will draw as blud color, and zoomlevel01-zoomlevel20 means in 01-20 these zoomlevels, line will draw as this color, you can change to 01-06,07-15 like this way to control the map, let it looks more beautiful.
Aslo you set Area style, Point Style, Text style, please refer HowDoISamples--->Feature Layers--->DisplayFeatureLayerAtCertainScale and ChangeTheLookOfAFeatureLayer to know more.
Regards,
Gary
thanks for the reply. We are trying to find a mechanism where Artist can provide color atribute and render them on application code. I think shapefiles doesnt provide colors by default. Please let me know If there is any good way to get artist defined colors on shapfile image. In our case one layer can have multiple colors, they can be lines, polygons etc… We dont change colors on different zoom levels.
Hello rajanikanth,
Thanks for your further information, shape file format does not support store any color information, so you need set it every time when you call it, maybe you can consider build a config file and let the artist edit the config by application forums and shapefilefeaturelayer read the config every time.
Also we support different colors for different types, like you can set DefaultLineStyle to a color for your lines, and set DefaultAreaStyle to a color for your polygons, and DefaultTextStyle for your labels, the code is almost the same, I think you can figure out very easily.
Regards,
Gary
Hmmn. I have the 100 mb shapefile from artist. It takes a minute to refresh the screen. which is not acceptable at all. Whats wrong you can think of? Is there other vector format which can improve the performace?
i found that i need use index files.
Hello rajanikanth,
Yes, build the index and use it will great improve the performance, also you can set the style of each zoomlevel to control limited resource render in different zoomlevel, that will lower the render time too.
Regards,
Gary