Geography Reference
In-Depth Information
Following our constructor, we need a function for initializing our map to be called from it.
Your code should look like this by now:
using System.Windows.Forms;
namespace SharpMapExample1
{
public partial class formMainForm : Form
{
private const string _connString = "Server ;Port=5432;User Id= ;Password=
;Database=gisbook;CommandTimeout=300" ;
private bool _mapInitializing ;
public formMainForm()
{
InitializeComponent();
}
public void InitializeMap()
{
}
}
}
Initializing the map
The first thing we need to do in our map initialization function is set up and load our layers.
We'll start with the county layer. The data source for the vector layer requires the names of
the geometry column and the primary key—otherwise known as OID or GID in geospatial
terms—which you must have in your geometry table, and the name of the table containing
your layer.
The code to initialize and load the county layer, give it a green fill, and set a black border
style is as follows:
const string countyTableName = "ukcountys" ;
const string countyGeometryColumnName = "the_geom" ;
 
Search WWH ::




Custom Search