i want to diaplay two different points on shapefile and save their coordinated in seperate vairables.
but i have problem, how to handle map clicks for e.g when user click first time draw a point and save its coordiantes in variable and when user click second time on differnt place save then again save its coordiantes in an other variable
here is my code of mapclick event
private void winformsMap1_MapClick(object sender, MapClickWinformsMapEventArgs e)
{
txtXCoordinate.Text = e.WorldX.ToString("N4", CultureInfo.InvariantCulture);
txtYCoordinate.Text = e.WorldY.ToString("N4", CultureInfo.InvariantCulture);
double latitude1 = Convert.ToDouble(txtXCoordinate.Text, CultureInfo.InvariantCulture);
double longitude1 = Convert.ToDouble(txtYCoordinate.Text, CultureInfo.InvariantCulture);
double lat2 = Convert.ToDouble(txtXCoordinate.Text, CultureInfo.InvariantCulture);
double long2 = Convert.ToDouble(txtYCoordinate.Text, CultureInfo.InvariantCulture);
Feature usr1 = new Feature(latitude1, longitude1, "Position1");
Feature usr2 = new Feature(lat2, long2, "Position2");
InMemoryFeatureLayer points = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("Points");
if (!points.InternalFeatures.Contains("Position1"))
{
points.InternalFeatures.Add("Position1", usr1);
}
if (!points.InternalFeatures.Contains("Position2"))
{
points.InternalFeatures.Add("Position2", usr2);
}
winformsMap1.Refresh();
}
problem in my code is new point doesnot display and all variables have same lat long