2

Our data is of pipelines and nodes wherein for each feature there is a line and a point node as end points.

So while copying parallel lines, we need to customize the OOTB tool so as to copy specific number of lines and create a node point at end of each line.

In general tool is working fine except for the scenario where it is a 'V' shaped feature i.e any angled feature.

I have attached the data before using our customised copy parallel and after using the tool.

I am working on ArcGIS 9.3.1 ESRI product.

After copy parallel Before copy parallel

closed as off-topic by PolyGeo Mar 22 '17 at 10:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    What is your purpose? creating point at the end of the line or both copy and create point? And Are you working with ILine or IPolyline? – Emi Feb 5 '13 at 6:22
  • Sorry forgot to mention. I am working on ArcGIS 9.3.1 ESRI product. I need to create a point feature for end vertices of each line. – Sheethal Feb 5 '13 at 6:26
2

If the layer is a feature layer, you can get IPolyline from each IFeature by IFeature.Shape Property.

IPolyline polyline = feature.Shape as IPolyline;
IPoint fromPoint = polyline.FromPoint;
IPoint toPoint = polyline.ToPoint;

Now create a point feature class and add these points as feature to that feature class.

EDIT

I am guessing you are working with all features of your feature class. If that is not right, just change the search method as you need:

List<IFeature> GetAllFeatures(IFeatureClass ArcFeatureClass)
{
    var featureCursor = ArcFeatureClass.Search(null, false);
    var features = new List<IFeature>();
    Geodatabase.IFeature feature;
    while ((feature = featureCursor.NextFeature()) != null)
        features.Add(new Feature(feature));
    return features;
}

List<IPoint> GetEndPoints(List<IFeature> features)
{
    var points = new List<IPoint>();
    foreach(var feature in features)
    {
        var polyline = feature.Shape as IPolyline;
        points.Add(polyline.FromPoint);
        points.Add(polyline.ToPoint);
    }
    return points;
}

Now create a point feature class. Suppose, name of that feature class is 'pointFeatureClass'. If you need help to create feature class, you can go through this.

void AddFeatures(List<IPoint> points, IFeatureClass pointFeatureClass)
{
    if (pointFeatureClass == null)
        return;
    foreach (var point in points)
    {
        IFeature feature = pointFeatureClass.CreateFeature();
        feature.Shape = point;

        feature.Store();
    }
}

This code will put a point on each end of a polyline. For your figure, it will create 8 points. If you want to customize it, you can put your own logic.

  • Hi Emi, Thanks for your response. I have improved my question if you see I have attached screenshots of the problem. Please provide your suggestions for the same. – Sheethal Feb 7 '13 at 5:52
  • @Sheethal, Is there only one polyline and you break it in every turn? Or there are 4 polylines? – Emi Feb 7 '13 at 5:57
  • There are 4 polylines. – Sheethal Feb 7 '13 at 6:20
  • @Sheethal does this works for u? – Emi Feb 7 '13 at 12:27
  • I need to copy parallel lines to the selected features. – Sheethal Feb 8 '13 at 2:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.