i have used sample method simplemarker overlayer. but it doesnot give the desired result. i want to add two point on shapefile by clicking on it and when it clicked its world coordinates saved in variable.
Place two points on shapefile by clicking on it for routing
Hi Sarah,
Can you clearify your requirements a bit, as far as i guessed, the anwser can be checked at gis.thinkgeo.com/Support/Dis...fault.aspx.
Any questions or problems please let us know.
Thanks,
Johnny
Also, please use InMemoryMarkerOverlay instead, seems like there is a bug in SimpleMarkerOverlay, we are still working on it.
Thanks,
Johnny
kindly tell me where i am wrong i used this way to get points and its coordinates. but when i assigned this user1 to routing layer startpoint like this
routingLayer.StartPoint = user1;
routingLayer.EndPoint = user2;
it gives error of null point. as i debug my code an see that user1 and user2 has coordinates but it cannot assigned to startpoint and end point
InMemoryFeatureLayer points = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("points");
// RoutingLayer routingLayer = (RoutingLayer)winformsMap1.FindFeatureLayer("RoutingLayer");
PointShape point = new PointShape(e.WorldX, e.WorldY);
Feature p = new Feature(point.GetWellKnownBinary(), "position");
points.FeatureSource.BeginTransaction();
if (!points.InternalFeatures.Contains("position"))
{
points.FeatureSource.AddFeature(new PointShape( p.WellKnownBinary));
if(user1== null)
{
user1 = new PointShape(p.WellKnownBinary);
}
else if(user2 == null)
{
user2 = new PointShape(p.WellKnownBinary);
}
Sarah,
Seems nohing wrong in your code, maybe there are some issues in other places. Can you please provide us a simple sample instead of code snippet to recreate your issue?
Thanks,
Edgar
may i send you my whole code because still i cannot figure out my problem. give me any email id
i have send my code on the given address Gray
Hello forum,
Did you check my code? i have send on the given address
Regards,
sarah
Hello Sarah,
Thanks for your code, we got it and we are working on it, once we have a solution, we will post here asap.
Sorry for the inconvenience.
Regards,
Gary
Thanks Gray i am really waiting for the solution
Hi Sarah,
You need to change your method to this:
private void winformsMap1_MapClick(object sender, MapClickWinformsMapEventArgs e)
{
InMemoryFeatureLayer points = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("points");
PointShape point = new PointShape(e.WorldX, e.WorldY);
Feature p = new Feature(point.GetWellKnownBinary(), "position");
points.FeatureSource.BeginTransaction();
if (!points.InternalFeatures.Contains("position"))
{
RoutingLayer routingLayer = (RoutingLayer)((LayerOverlay)winformsMap1.Overlays["RoutingOverlay"]).Layers["RoutingLayer"];
points.InternalFeatures.Add(p);
if (user1 == null)
{
user1 = point;
routingLayer.StartPoint = user1;
}
else if (user2 == null)
{
user2 = point;
routingLayer.EndPoint = user2;
}
else
{
goal = new PointShape(p.WellKnownBinary);
}
}
points.FeatureSource.CommitTransaction();
winformsMap1.Refresh();
}
Regards,
Edgar
Thanks a bundle edgar
Sarah,
You're welcome, please feel free to let us know your problem.
Regards,
Edgar