3

I have a map in shapefile format with buildings. I'd like extract the coordinates of this polygon. E.g. if a house has a polygon of four points, I'd like to know the coordinates of those points and how to know which points belong to the same building.

I'm very new with ArcGIS, so please bear with me. I can get centroids of this buildings in a table, but not boundary points. If I click on a single point on a boundary, the identity shows different X and Y points, but can't figure it out how to extract them in a single table.

I can't seem to find a similar example on this forum...

7
  • do you have an advanced licence ?
    – radouxju
    May 27, 2015 at 13:14
  • I have a trial version. So probably not.
    – energyMax
    May 27, 2015 at 13:19
  • Do you want a python solution?
    – Aaron
    May 27, 2015 at 13:25
  • 1
    check if you have "feature vertices to points"
    – radouxju
    May 27, 2015 at 13:26
  • 1
    ".shx" is not a format -- it's one of the component files of the shapefile format (and not the most important, since you can almost do without it).
    – Vince
    May 27, 2015 at 14:31

2 Answers 2

2

I replicated the results you are looking for using the “feature vertices to points” tool and an available buildings layer on hand.

Steps 1-5 is because I prefer working from a geodatabase. Can you open ArcCatalog to your working folder and preform the following steps?

1) Open ArcCatalog and navigate to your working folder.

2) Right click and selecting NEW -> File Geodatabase, give it a name.

3) Double click the file geodatabase in ArcCatalog, right click and select NEW -> Feature Dataset.

4) Give it a name then select the coordinate system you are utilizing. You can press the ‘Add Coordinate System’ button next to the star, select ‘Import’ and navigate to your building shapefile. This will import the coordinate system from the building shapefile to the Feature Dataset.

5) Double click the feature dataset, right click select ‘Import’ -> ‘Feature Class (single)’, Select the building shapefile as the Input Features and give the Output Feature Class a name.

Now you have a geodatabase with your building layer in a feature dataset and any new layer you output to the same feature dataset will be assigned the coordinate system of the dataset.

Select the “feature vertices to points” tool in the Data Management Tools -> Features toolbox, set the input features as your building layer within the geodatabase, assign the output feature class to your geodatabase feature dataset and name it, and choice Point Type as “ALL”.

This creates a feature class where each of the vertices from all buildings is an independent feature. It also appears to copy all attributes from each building to the corresponding vertices point. If your building already had an X & Y coordinate attribute before running the tool these values would be copied over giving the impression all building vertices have the same values. You can either recalculate the existing fields in the “Feature Vertices to Points” Output layer or add two new fields to the attribute table with a double field type and right click the field name and select calculate geometry and recalculate the values.

EDIT------------------------------------------------------

If you are in the US you can use the Geographic Coordinate System -> North American -> NAD 1983 coordinate system. Globally, Geographic Coordinate System -> World -> WGS 1984 is one of the most commonly used worldwide.

To export a feature class’s attribute table to Excel you want to open the layers attribute table in ArcGIS and preform the following steps.

1) Select the features you want exported, if there are no features selected then ALL features will be exported.

2) Click the ‘Table Options’ button (top left), select Export, click the browse button, Change the ‘Save as Type:’ option to ‘Text File’ and name the file and save it to a folder.

3) Open Excel, click File -> Open, and browse to the folder where you saved the .txt file.

4) Change the viewable file types to ‘All Files (.) and open the saved .txt file, A Text Import Wizard box will open.

5) On Step 1 of 3 you can click Next, On Step 2 of 3 you want to click the checkbox next to ‘Comma’. This will separate the fields from ArcGIS to separate fields in Excel, click Next and Finish.

For longitude and latitude options if you want the data to be in decimal degrees such as -79.23545 you need the field type to be set to a numerical format such as Double, if you want the longitude and latitude to be in Degree Minutes Seconds such as 77° 2' 47.296" W you need to set the field type to Text and a length of at least 17 characters.

6
  • It works great! May I further ask how to export all those points to e.g. excel and which coordinate system i have to define, in order to get longitude and latitude? At the momemt a national system is defined
    – energyMax
    May 27, 2015 at 16:40
  • I've edited the previous answer to resolve your question in the comment due to character limitations here. LMK if you have any additional issues/questions.
    – kbn0526
    May 27, 2015 at 17:24
  • Big thanks! Regarding the coordinate system - I have WGS 1984 all the time, but i don't have longitude and latitude coordinates. They are in ETRS format, since a random point has coordinates e.g. 539283.817 , 155325.713- which are of course not lat and long
    – energyMax
    May 27, 2015 at 17:35
  • I suggest you open a New Blank ArcGIS map document and only add the Vertices Output file from the WGS 1984 dataset that was generated from the tool. Right click ‘Layers’ in the table of contents, click ‘Coordinate Systems’ tab, the current coordinate system should read ‘GCS_WGS_1984. Start editing, open the attribute table, right click the Lat/Lon field and calculate geometry. The data source & data frame should be GCS: WGS 1984 and units are either decimal degrees or Degrees Minutes Seconds.
    – kbn0526
    May 27, 2015 at 18:04
  • Your data and preferably the data frame must be in a Geographic Coordinate system for you to acquire Lat/Long values. Any coordinate system under Projected Coordinate System will not produce Lat/Lon values as they are measured in feet/meters/miles, ect from a 0,0 point generated to the south west of the defined area. The data frame in ArcGIS assumes the coordinate system of the first layer that is added to a map. This is the coordinate system that is used to project your data with the program.
    – kbn0526
    May 27, 2015 at 18:17
2

You can do this with the Python script provided by Esri in the "Reading Feature Geometry" section of ArcGIS Online Help.

http://resources.arcgis.com/en/help/main/10.1/index.html#//002z0000001t000000

Here is the script provided in the said reference:

import arcpy

infc = arcpy.GetParameterAsText(0)

# Enter for loop for each feature
#
for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]):
    # Print the current multipoint's ID
    #
    print("Feature {0}:".format(row[0]))
    partnum = 0

    # Step through each part of the feature
    #
    for part in row[1]:
        # Print the part number
        #
        print("Part {0}:".format(partnum))

        # Step through each vertex in the feature
        #
        for pnt in part:
            if pnt:
                # Print x,y coordinates of current point
                #
                print("{0}, {1}".format(pnt.X, pnt.Y))
            else:
                # If pnt is None, this represents an interior ring
                #
                print("Interior Ring:")
        partnum += 1

This can be further customized to add the points to the original FC table by adding fields and an Insert cursor. For example, you could add a text field called "Coord_Pairs" and then create a string for every row as the points are found.

#place something like this outside and above the "for pnt in part" section of the above code.
newCoorPairs = ""

#place something like this inside the "for pnt in part" section of the above code.
newCoorPairs += "(" + str(pnt.x) + ", " + str(pnt.y) + ") "

Once you have the coordinate pairs stored in newCoorPairs you can use the insert cursor to put this string into the FC table.

4
  • Thanks. It works, but i have further questions. Are the points suppose to be the same? the coordinates do not have the exact same values. e.g. map shows X coordinate 539.787,664 - python code shows the X coordinate value 539.788,0601?! And why i cant see all the points, that the code generated but only approximately 2/3? I have points from 450 to 1500, but not from 1 to 449.
    – energyMax
    May 27, 2015 at 14:48
  • Do you perhaps know why i can't see all points?
    – energyMax
    May 27, 2015 at 16:08
  • I'm not entirely sure what your comment is asking. "Are the points suppose to be the same?" What are you referring to here? Also, When you say "all the points" what is the range of 450 to 1500 referring to?
    – GeoJohn
    May 27, 2015 at 16:41
  • The range is reffering to number of polygones. As it seems, i have over 1500 polygones. And as I run the code, i can see only the ones from 450 to 1500.
    – energyMax
    May 27, 2015 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.