Wednesday 28 June 2017

arcgis desktop - XYToLine and Error 999999


When attempting to convert this text file to lines using the XYToLine tool I keep getting the generic ERROR 999999. What is going on?


ID  SrcX        SrcY        DstX        DstY
1 905653.9545 728436.4238 905130.0745 727809.7597

2 914841.5615 724105.0236 914777.3853 723706.6229
3 865711.6414 722514 865431.546 722264.887
4 861556.3599 724077.2146 860963.8363 723713.0272

Result:


Executing: XYToLine test_line.txt X:\Env-dat.082\default.gdb\links_from_txt SrcX SrcY DstX DstY GEODESIC ID "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision"
Start Time: Thu Sep 03 14:58:32 2015
ERROR 999999: Error executing function.
Failed to execute (XYToLine).
Failed at Thu Sep 03 14:58:33 2015 (Elapsed Time: 1.42 seconds)


Answer



In this case the error means "trouble parsing input file". There are actually 3 problems here. I'm not sure if the 99 problem would have cropped up with any single one or whether it requires a constellation.


Mix and match white space delimiters. Rows were using tabs while the header which was added manually used spaces (in Notepad++ hit the "show all characters" toolbar button, ¶).


text file screen shot


Fixed width delimited. The program which generated this text file left out implied digits, so 1273629 instead of 1273629.0000, however it then added an extra tab to keep the columns line up. Nothing wrong with this, it's standard practice in fixed-width delimited files, however XYToLines doesn't know about those.


double tab as single delimiter


Completely wrong coordinate system! 905653.9545 728436.4238 905130.0745 727809.7597 are clearly not geographic or decimal degrees numbers which can't be higher or lower than 180.0 and -180.0. I should have seen this immediately but was distracted by the other errors. (This problem doesn't generate an error message, just the wrong result of zero-length lines).


.


UPDATE: In follow up testing, it turns out that




  • Header line is optional. If left out XYToLine shows "Field1, Field2, ..."

  • Only one thing to fix in order to avoid error, it is sufficient to search and replace double-tab with single (\t\t with \t).


.


What a sad state of affairs, "Error: 999999" happens so often it has it's own tag! Anyway, this took me a couple of hours and two days to solve, so I figure it's worth adding to the noisy heap.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...