Coloring Shapefile Bathymetry Lines

Apr 19, 2012 at 6:32 AM

I suspect this is an easy question...I hope.

I'm a relative n00b trying to navigate my way around the various Shapefile classes and such. At this instant I'm trying to use DotSpatial to load shapefiles for me and then draw them in my own pre-existing map code.

Problem: I can't figure out how to color various bathy shapefiles. The shapefiles seem to come with a bunch of depth information, but none of the info is standard (the attributes list DEPTH, DEPTH_M, DPT, etc.). And nothing I can see indicates color for each LineString.

Any suggestions on how to simply figure out a color for these suckers? I'm hoping this is some really obvious property or whatever I'm overlooking in the debugger...

Thanks!

Developer
Apr 19, 2012 at 5:06 PM

From what I can tell shapefile don't include any color information. We use a symbolizer that randomizes the color by default and I've seen other products that paint everything a single base color.

When the user sets up a color scheme this can be saved in another file beside the shapefile (with a different extension), or as part of the project file.

Does this help?

Apr 19, 2012 at 6:18 PM

(posting as a reference for future searchers/readers...)

I've done more research myself. Looks like there are a number of sidecar files that are "somewhat standard" with shapefiles; these sometimes contain coloring information. One that definitely can contain colors is an .avl (ArcView Legend) file, apparently from older versions of ArcView. It is actually a text file but with relational records in it that are straightforward to decipher just by looking at it. I haven't been able to totally figure out how to map DotSpatial's ShapeFile.Attributes.Columns information (which DotSpatial parses from the .dbf file) to colors in an .avl file, however - there must be some way to do this, I just haven't figured out which field in the .avl file specifies the column name that drives the coloring values. This article describes some reverse-engineered details of avl: http://blogs.ugidotnet.org/GisSharpBlog/archive/2005/01/13/9215.aspx that might help.

There are also .shp.xml files that look like they can contain colors - in my brief scan for samples, however, I haven't seen anything that obviously looks like a color key/legend...yet.