labbansa

python code

Discussion created by labbansa on Mar 21, 2013
Latest reply on Mar 21, 2013 by curtvprice
i have  txt file that contains parcels with coordinates. and i want to do the following:
Reads in an input text file (parcels.txt). The structure of the text file is the following:
Feature: 0 (parcel id) R34(map number) 020(lot number)
909447.38 419869.40
909397.28 419798.69
A line identifying the parcel, followed by the map number and lot number, then a list of (x,y) points that define the parcel.
From the text file records, i want to creates an output polygon shapefile with attributes: parcel-ID, Map#, Lot#, area
From the text file records, i want to creates an output polyline file (each polyline is just 2 points) with attributes parcel-ID, Map#, Lot#, length
can you help me with python codes that accomplished my task.
the format of my file is as following: (two parcels)
Feature: 2 R34 021
908099.01 420797.75
908062.57 420745.41
908006.36 420783.93
908046.51 420834.57
908050.35 420839.43
908102.95 420803.41
908099.01 420797.75
Feature: 3 R34 022
908006.36 420783.93
907989.27 420762.38
907978.91 420802.59
907956.43 420894.59
907953.74 420905.58
908050.35 420839.43
908046.51 420834.57
908006.36 420783.93

Outcomes