public _prop_SnapLtrans getAllData(double lat, double lon, double radius) { _prop_SnapLtrans data_gis = null; PolylineDistanceInfo polylineDistanceInfo; PointD pt = new PointD(); pt.X = lon; pt.Y = lat; if (!(sf.ShapeType == ShapeType.PolyLine || sf.ShapeType == ShapeType.PolyLineM)) { return(null); } int index; EGIS.ShapeFileLib.ConversionFunctions.RefEllipse = 23; index = sf.GetClosestShape(pt, radius, out polylineDistanceInfo); if (index >= 0) { Console.Out.WriteLine("LineSegmentSide:" + polylineDistanceInfo.LineSegmentSide); if (sf.ShapeType == ShapeType.PolyLine) { data_gis = new _prop_SnapLtrans(); double total = 0; PointD[] data = sf.GetShapeDataD(index)[0]; for (int i = 0; i < data.Length - 1; i++) { total = total + ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, data[i].Y, data[i].X, data[i + 1].Y, data[i + 1].X); } double distance_to_end = 0; for (int i = polylineDistanceInfo.PointIndex; i < data.Length - 1; i++) { distance_to_end = distance_to_end + ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, data[i].Y, data[i].X, data[i + 1].Y, data[i + 1].X); } double distance_snap = ConversionFunctions.DistanceBetweenLatLongPoints(INDEX_WGS_84, lat, lon, polylineDistanceInfo.PolylinePoint.Y, polylineDistanceInfo.PolylinePoint.X); string side_of_road = GetLineSegmentSideDescription(polylineDistanceInfo.LineSegmentSide); double distance_to_start = total - distance_to_end; data_gis.lattitude_on_line = polylineDistanceInfo.PolylinePoint.Y; data_gis.lontitude_on_line = polylineDistanceInfo.PolylinePoint.X; data_gis.side_of_line = side_of_road; data_gis.snap_distance = distance_snap; data_gis.index_shape = index; data_gis.tVal = polylineDistanceInfo.TVal; data_gis.calculate_length_line = total; data_gis.distance_snap_to_start = distance_to_start; data_gis.distance_snap_to_end = distance_to_end; data_gis.data_db = this.dbr.GetFields(index); data_gis.dt = DbfToTable(dbr.GetFieldNames(), data_gis.data_db); if (data.Length > 0) { data_gis.lat_start = data[0].Y; data_gis.lon_start = data[0].X; data_gis.lat_end = data[data.Length - 1].Y; data_gis.lon_end = data[data.Length - 1].X; } } } return(data_gis); }