Thursday, September 30, 2010

Create points from a line (ArcGIS)

I need two text files, one with the x coordinates and another with the y coordinates of a stream (to put into matlab). I have a polyline shapefile of the stream in ArcGIS. Don't know if this is the easiest way, but it works :)

1. In ArcCatalog, make a new point file with the same coordinate system as your line file.
2. In ArcGIS, start editing your POINT file, and select the line you want to make poins for (so that it is highlighted green).
3. Under the editor pull down (in the editor tool bar) select to 'divide'.
Choose the second option: 'place points separated by every __ units' (the units are your map units... you can check this under dataframe properties).
4. Stop editing.
5. Open the 'Add XY Coordinates' tool. (ArcToolbox>Data Management Tools>Features)
Choose your point shapefile and say OK.
6. Once it's complete, open the attribute table for your point shapefile.
7. Under attribute table options, choose 'export' and save your file as a .dbf file.
8. Open this file in excel (excel is the default program to open .dbf files anyway).
9. For my matlab application I need two files, one with just x coordinates, and one with just y coordinates, so I made two copies of this file and deleted all but the POINT_X column in one and all but the POINT_Y column in the other. Then for each I deleted the title row, changed it to scientific notation and saved the file as a text(ms dos) file.
10. Wahoo! maybe there is an easier way to do this, but it works :)

7 comments:

  1. you are the best, thank you SO MUCH!

    - your secret admirer

    ReplyDelete
  2. It really depends what you want, but if you want to create a single point from multiple lines you could do this:
    1. Open attribute table polyline
    2. Add field (2x) name them x and y
    3. Calculate x and y geometry (choose center)
    4. Export the attribute table (polyline) to .dbf
    5. Tools -> add x,y data
    6. Select your created .dbf file and select x and y fields you just created.
    7. Now you should have a new file, you can export this to a shapefile (point).

    Hope this helps..

    ReplyDelete
  3. Tool: Lines to points

    ReplyDelete
  4. Great, thank you!

    ReplyDelete
  5. They've changed the tool name from "divide" (as described above) to "construct points".

    ReplyDelete