In this topic, you add a label to a geographic point, the geographic coordinates of Erie, Pennsylvania (USA), using a C1VectorLayer and a C1VectorPlacemark (see Vector Layer for more information).
To know how to manipulate element visibility according to the scaling of the map, please see the Element Visibility section in the topic Vector Layer.
Add the following markup between the <c1:C1Maps> </c1:C1Maps> tags to add a label over the maps control:
Source View |
Copy Code
|
---|---|
<Layers> <c1:C1VectorLayer> <DataWijJson> <vectors> <c1:C1VectorPlacemark Label="Erie, PA" Point="-80.0852, 42.1296" > </c1:C1VectorPlacemark> </vectors> </DataWijJson> <Placemark LabelVisibility="Visible" /> </c1:C1VectorLayer> </Layers> |
C# |
Copy Code
|
---|---|
// Create layer and add it to the map C1VectorLayer vl = new C1VectorLayer(); C1Maps1.Layers.Add(vl); // Set the datasource type to use vl.DataType = DataType.WijJson; // Set the Label visibility vl.Placemark.LabelVisibility = LabelVisibility.Visible; //Create a vector placemark and add it to the layer C1VectorPlacemark vp1 = new C1VectorPlacemark(); vl.DataWijJson.Vectors.Add(vp1); // Set the placemark to a set of geographical coordinates vp1.Point = new PointD(-80.107008, 42.16389); // Set the placemark's label and properties vp1.Label = "Erie, PA"; |
VB |
Copy Code
|
---|---|
' Create layer and add it to the map Dim vl As New C1VectorLayer() C1Maps1.Layers.Add(vl) ' Set the datasource type to use vl.DataType = DataType.WijJson ' Set the Label visibility vl.Placemark.LabelVisibility = LabelVisibility.Visible 'Create a vector placemark and add it to the layer Dim vp1 As New C1VectorPlacemark() vl.DataWijJson.Vectors.Add(vp1) ' Set the placemark to a set of geographical coordinates vp1.Point = New PointD(-80.107008, 42.16389) ' Set the placemark's label and properties vp1.Label = "Erie, PA" |
The following image shows a C1Maps control with the geographic coordinates of Erie, Pennsylvania (USA) labeled.
The theme of the form has been set to metro-dark, for a better visibility of the label.