Ben
Ben

Reputation: 3912

Generate .dbf files in .Net

I am using the DevExtreme XPF MapControl and am trying to create the below style of map:

enter image description here

The only way I can see to generate this type of map is by using shape files with an associated ".dbf" file to generate the colours for the countries. The maps will be generated at runtime from data in a database which means I can't pre-prepare the ".dbf" files. Does anyone know of a way to programatically do this?

Upvotes: 1

Views: 2605

Answers (2)

Ben
Ben

Reputation: 3912

The way I ended up doing this was by storing the KML files for all countries, regions and cities that I cared about, and then plotted them on the map using polylines.

Upvotes: 1

Maxim Ocheretianko
Maxim Ocheretianko

Reputation: 58

You can use DotNetDbf to easily generate .dbf files

Example

using (Stream fos = File.Open(@"C:\Foo.dbf", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
    var writer = new DBFWriter();
    var field = new DBFField("Foo1", NativeDbType.Numeric, 15, 0);
    writer.Fields = new[] { field };

    writtenValue = 123456789012345L;
    writer.AddRecord(writtenValue);
    writer.Write(fos);
}

Upvotes: 1

Related Questions