2

I ran the AddXY Coordinates tool on a feature class that did not have any coordinates fields. I now have two fields "POINT_X" and "POINT_Y". My objective is to convert the value in those two fields into degrees/minutes/seconds. I have tried the Convert Coordinate Notation tool but I always get empty fields in for the coordinates. Here is an example of what I am running:

arcpy.ConvertCoordinateNotation_management ("Orchids_Layer", "Orchids.shp", "POINT_X", "POINT_Y", "DD_2", "DMS_2","","",sr)

enter image description here

The image shows you the results I get from trying to convert "POINT_X" and "POINT_Y" using the above code. My input file's spatial reference is 'GDA_1994_MGA_Zone_56'.

What am I doing wrong?

  • I've never used this tool before but it looks like those X/Y values are Easting/Northings not Latitude/Longitudes. Your input_coordinate_format argument, "DD_2", refers to Longitude/Latitude so may be incorrect. – nwduncan Sep 20 '17 at 4:36
4

You are using a wrong tool. The Convert Coordinate Notation tool doesn't support the coordinate system you are using. You should be using the Add Geometry Attributes tool instead.

arcpy.management.AddGeometryAttributes("Features_", "POINT_X_Y_Z_M", 
                                       None, None, 
                                       "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")

This will add (or in your case, overwrite) two new fields, POINT_X and POINT_Y to your feature class with the coordinates in DD format (WGS84 coordinate system). If you wish to get coordinates in DMS, now you can use the Convert Coordinate Notation tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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