2

I have an issue with the "PointsToLine" function in Python arcpy and in the tool dialog, the problem comes everytimes I use a POINT Feature Class (FC) created from the "Make Route Event Layer" function (Linear Referencing).

All the properties seem to be the same as a regular (working) POINT class, but the error keeps prompting with such created FC. Is there something I am missing? Is this a known issue? Is there a workaround for this?

Here is my simplified code to generate the Point FC used for the "PointToLine" function:

import arcpy

table_points_TEST = "C:\\ArcGIS\\Test.gdb\\TEST_TABLE_TO_LINE"
axe_repere = "C:\\ArcGIS\\Test.gdb\\AXE_REPERE"
table_points_TEST_TEMP = "C:\\ArcGIS\\Test.gdb\\TEST_TABLE_TO_LINE_TEMP"
FC_point = "C:\\ArcGIS\\Test.gdb\\FC_POINT"
FC_line = "C:\\ArcGIS\\Test.gdb\\FC_LINE"

arcpy.MakeRouteEventLayer_lr(axe_repere , "AXIS_NAME", table_points_TEST, "AXE POINT M_POINT", table_points_TEST_TEMP)
arcpy.CopyFeatures_management(table_points_TEST_TEMP, FC_point)

arcpy.PointsToLine_management(FC_point,FC_line)

If I use the Point layer generated by the "CopyFeatures" in the "PointToLine" tool dialog, the same error occurs.

  • 1
    What happens when you use the tool from its tool dialog instead of from a Python script? – PolyGeo Oct 31 '16 at 12:21
  • I have exactly the same error, and I have reproduced this issue with other POINT feature classes created with different linear references. – JustAsking Oct 31 '16 at 12:29
  • In that case it is not an ArcPy problem so I think you should edit it to focus on the tool and the parameter values that you are supplying to it. – PolyGeo Oct 31 '16 at 12:32
  • Well, the only function I tried with the tool dialog is "PointToLine". I can't reproduce this script completely in the ArcToolBox since the "MakeRouteEventLayer" produce a temporary value that can't be accessed by "CopyFeatures_management". And the only parameter I supplied to "PointToLine" is the Point Class. I am the only one who got this issue with the same combination of fonctions? – JustAsking Oct 31 '16 at 13:03
2

If you look at the SYNTAX section of the help file for this tool the fifth parameter is a "layer stored in memory".

In your code you have given a location for a FeatureClass using the variable table_points_TEST_TEMP and not an in memory layer name.

If you scroll down to the CODE SAMPLE section you can see examples of how to run this tool and the correct parameters. In your case I believe you need only provide a layer name (you are not defining a source), you create a permanent copy of this using the Copy Feature tool.

  • 1
    Thanky you for your answer! You find out a really interesting point. But I figure out where the problem was. I was working with a french language package, when I create a new Point FeatureClass with the MakeRouteEventLayer function,, this creates a field named "Forme*", not "SHAPE*". I guess it confuses the PointToLine function to deal with 2 different names for shapes. When I take default language (English), it works as expected. – JustAsking Nov 2 '16 at 8:34
  • Blimey that is a new one on me! Tres bien! :-) – Hornbydd Nov 2 '16 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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