shapefile to grid

Jul 11, 2012 at 1:29 PM

Hi there,

I'm an absolute beginner with DotSpatial.

I have to build an application that reads a polygon shapefile, converts it to a grid (as file or even better as an array in RAM) and passes this with a bunch of parameters to an already existing .dll which processes the data.

So I'm now trying to 'rebuild' the shp2grid-Plugin for MapWindow4 (mapwingis) on the DotSpatial-Library. But after severals hours of trying I couldn't find a way to access the field names of the shapefile so that the user can choose the attribute field for the grid cell values. 

Can anyone help me with this or has even already built a tool based on DotSpatial that converts shapefile to grid?

Another question: is there a possibility to remove a single layer (by layer or by count) from the map? I only found DotSpatial.Controls.Map.ClearLayers() which removes all layers in one.

Thanks for your help.

Claudia

Developer
Jul 11, 2012 at 5:58 PM

To address your last question... Check out the Layers collection on the Map object.  It has a RemoveAt() method.

Kyle

Developer
Jul 12, 2012 at 4:42 PM

The field names are inside of the DataSet DataTable property. See the DotSpatial.Data.AttributeTable for more.

layer.DataSet.DataTable;
Jul 16, 2012 at 12:40 PM

Thanks mudnug,

this works.

 

Developer
Jul 16, 2012 at 5:55 PM

Glad to help!