1

I am now using SharpMap for creating a network-based tool. By using SharpMap, for constructing network, the current functions in SharpMap enables the tool to capture coordinate on background layer and then creates geometrical points and polylines. Following this step I could create either point-based, or polyline-based vector layers.

Now I need to display each geometry into different colours on same vector layer based on their "risk index": a value to assess the gradient colours needed to use. From SharpMap discussion I understand we could not add data attribute to the layers in the 1.0 version, and only Data Column in vector layer can be used to render the colours of elements.

My difficulty is: since I created the vector layer by myself and not imported from external data source, and therefore there is no attribute table attached to each layer, it means, no attribute table in the layer. Therefore, I am wondering are there any methods available that I can render my layers not based on attribute table?

1

You would have to create a custom provider for your business object.

Implementing the SharpMap.Data.Providers.IProvider interface is not that hard. Basically you have to provide the means to setup a SharpMap.Data.FeatureDataTable object that resembles your business object. in your case it needs an identifier (uint) and your risk value (double?).

Have a look at the provider implementations present if you don't know what purpose they are for.

Maybe we should provide a BusinessDataProvider<TFeature> : IProvider class to faciliate this.

1
  • Many thanks! It is really great! Based on this method, I looped all points and polyline geometries and encapsulated each geometry and a "Risk Index" into a FeatureDataRow. I attached all FeatureDataRow into a new FeatureDataTable to construct a vector layer which then has a column for risk analysis. – kaka Feb 12 '14 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.