Skip to main content

How to: Manually Generate Vector Items from WKT

To manually provide vector items from the Well-Known Text, do the following.

private void Form1_Load(object sender, EventArgs e) {
    SqlGeometryItemStorage storage = new SqlGeometryItemStorage();

    storage.Items.Add(SqlGeometryItem.FromWkt("POINT(-0.1275 51.507222 0 10)", 0));
    storage.Items.Add(SqlGeometryItem.FromWkt("POINT(12.5 41.9 0 10)", 1));
    storage.Items.Add(SqlGeometryItem.FromWkt("POINT(2.3508 48.8567 0 10)", 2));
    storage.Items.Add(SqlGeometryItem.FromWkt("POINT(13.38 52.52 0 10)", 3));
    storage.Items.Add(SqlGeometryItem.FromWkt("POINT(-3.68 40.4 0 10)", 4));

    VectorItemsLayer layer = new VectorItemsLayer() { Data = storage };
    layer.DataLoaded += layer_DataLoaded;
    mapControl1.Layers.Add(layer);
}