Hi,
I have some geology shapefiles with areas. Each area has different attributes - rock type, rock age, etc. Each attribute has different string values.
How can I paint each area with different color depend on this string value?
Thank you,
Igor
Hi,
I have some geology shapefiles with areas. Each area has different attributes - rock type, rock age, etc. Each attribute has different string values.
How can I paint each area with different color depend on this string value?
Thank you,
Igor
Hello Igor,
Thank you for your post.
For your scenario, you can use either the ValueStyle or ClassBreakStyle. Each of these will allow you to draw a different type of style based upon a column value in your Layer.
And here is the detail for two style:
ValueStyle : This class allows you to match a value with data in the feature to determine how to draw that feature.
ClassBreakStyle : This class represents a style based on class break values(A range of values).
You can see the HowDoISampels—>Styles—>Draw Features Based on Values and HowDoISamples—>DataProviders—>Load a GridFileFeatureLayer.
Let us know if you meet problems.
Regards,
Gary
Thank you very much, Gary! It works perfect.
I have some more questions:
Is it possible to create style with our own icons?
The point is that I have 2 columns - rock age and rock type - and I should create 2 ValueStyles and add them to my GeologyLayer. The first ValueStyle can be color, but the 2nd one - should be some shade.
Is it possible to create styles like this: ims.infomine.com/51772/image.gif
Hello Igor,
If you shapefile including some points, that's possible to show the points with your own icons, just create the new pointstyle in the valustyle, if not, we don't have exist api to do that.
There is a workaround I can think about, create your own style inherit from AreaStyle, in the drawCore method, draw the points even inside the features, that will let the feature area looks like what your images are.
Regards,
Gary
Thank you, Gary! Unfortunately, my shapefiles consists of polygons only.
Could you tell me please how can I draw the point inside the polygon?
... and I understood that there are no shade style?
Actually, I’ve found CreateHatchStyle method to draw dashed/dotted lines. It could work for me, if there is no posibility to create backround image for area.
Hello Igor,
Yes, if you are not really want to use your own icon, just want the shape shows the difference, I think hatchstyle is very good choice.
Please feel free to let me know if you meet any other problems.
Regards,
Gary