latitude and logitude of polyline

7/23/2014 4:24:43 AM
Total Posts 28

latitude and logitude of polyline

I have a code that display render shape file ArterialCollectorHighway on map

layer = tileLayer.AddLayer(consts.SHAPEFILE_DIR + "ArterialCollectorHighway.shp");

layer.LabelField = "ROAD_NME";

layer.ShowLabels = true;
layer.Symbol.Size = 7;
layer.Symbol.LineStyle = LineStyle.Road;
layer.Symbol.FillColor = Color.FromArgb(255, 246, 143);
layer.LabelFont.Color = Color.SlateGray;

renderer = layer.Renderer;
renderer.Field = "FTR_CRY";
feature = renderer.Add();
feature.Value = "RDA";
feature.Description = "T333";
feature.LabelFont.Size = 7;

....

now after this  I hv added a code

...

renderer = layer.Renderer;
renderer.Field = "ROAD_NME";
feature = renderer.Add();
feature.Value = "Rajaji Marg";

feature.Description = "T333";
feature.LabelFont.Size = 37;
feature.Symbol.LineStyle = LineStyle.ArrowStart;
feature.Symbol.FillColor = Color.FromArgb(255, 31, 31);

..

this will display line on map corresponding to polyline Rajaji Marg

But I need to find lat,log of start  and end of  this polyline.

Is their any way to get lat,log of start and end of particular polyline...?

 

 

7/23/2014 4:43:45 AM
MVP
Total Posts 323

Re: latitude and logitude of polyline

layer = Layer.Open(consts.SHAPEFILE_DIR + "ArterialCollectorHighway.shp")

rs = layer.SearchExpression("ROAD_NME = \"Rajaji Marg\"");

if (!rs.EOF)

{

   start = rs.Shape.GetPoint(0);

   end = rs.Shape.GetPoint(rs.Shape.PointCount-1);

   // start.X - longitude

   // start.Y - latitude

}

 

7/23/2014 5:40:07 AM
Total Posts 28

Re: latitude and logitude of polyline

Thanx Bro