AnsweredAssumed Answered

XY Coordinates to Structured NumPy Array

Question asked by Playa on Mar 12, 2015
Latest reply on Mar 13, 2015 by Dan_Patterson



I've used the Near Analysis tool which has added the following fields:


  • NEAR_X (X Coordinate)
  • NEAR_Y (Y Coordinate)


I'd like to use the following fields from the output of using the Near Analysis tool to generate a Structured NumPy Array:


  • HydroID (Unique ID: Long Integer)
  • NEAR_X (X Coordinate)
  • NEAR_Y (Y Coordinate)


I've read through the ESRI online help documentation on:



, and I'm unable to figure out how to generate a Structured NumPy Array that I can use as input to NumPyArrayToFeatureClass. The Structured NumPy Array format that is required as input to NumPyArrayToFeatureClass is:


array = numpy.array([(1, (471316.3835861763, 5000448.782036674)),
                     (2, (470402.49348005146, 5000049.216449278))],
numpy.dtype([('idfield',numpy.int32),('XY', '<f8', 2)]))


From what I gathered the coordinates are stored as tuples within the Structured NumPy Array. I'm still learning to code so any assistance in how to covert my data into a Structured NumPy Array that I may use as input into NumPyArrayToFeatureClass will be appreciated.