AnsweredAssumed Answered

How to read out coordinates of a txt file and create a shapefile

Question asked by yde on Jul 3, 2013
Latest reply on Jul 4, 2013 by yde
Hi I have already, the coordinates:

import arcpy import re  from itertools import product pnt = arcpy.Point() KEY_VALUE_RE = re.compile(r'([a-z_][a-z0-9_]*)=(\d+(?:\.\d*)?)')  def main():     points_to_search_r = [         'p{0}_{1}w'.format(a, b) for a, b in product([1, 2, 4, 6, 7, 9], 'r')     ]     points_to_search_h = [         'p{0}_{1}w'.format(a, b) for a, b in product([1, 2, 4, 6, 7, 9], 'h')     ]           with open('F:\\Rasterdaten\\SRV\\2005\\TK100\\c4706_3.txt') as lines:         for line in lines:             variables = dict(                 (k, float(v)) for k, v in KEY_VALUE_RE.findall(line)             )             for point_r in points_to_search_r:                 value_r = variables.get(point_r)                 if value_r is not None:                     #print '{0} {1}'.format(point_r, value_r)                     pnt.Y = value_r                     #print pnt.Y                                 for point_h in points_to_search_h:                 value_h = variables.get(point_h)                 if value_h is not None:                     #print '{0} {1}'.format(point_h, value_h)                     pnt.X = value_h                     #print pnt.X                     if __name__ == '__main__':     main()


And I have a code for read out coordinates of a dbf file and create a shapefile:

import arcpy  arcpy.env.overwriteOutput=1 arcpy.env.workspace = "E:\\mxd\\Shapefiles\\" arcpy.CreateFeatureclass_management(arcpy.env.workspace, "test_polygon.shp","POLYGON") cur=arcpy.InsertCursor("test_polygon.shp") lineArray = arcpy.Array() pnt = arcpy.Point() cur2 = arcpy.SearchCursor("F:\Rasterdaten\SRV\\gps_points.dbf")  for row in cur2:      pnt.X = row.getValue("x")     pnt.Y = row.getValue("y")      lineArray.add(pnt)  feat = cur.newRow() feat.shape = lineArray cur.insertRow(feat) print "Berechnung beendet"  del cur del cur2 del row


How can I combine this two?

Outcomes