2

I am trying to buffer a PointGeometry object in arcpy to a Polygon geometry object with ArcGis 10.2.

The PointGeometry object is in lat/lon WGS84 coordinates and as far as I understand, I can only use PointGeometry.buffer by specifying the buffer in the same coordinates. To specify the buffer in metres, I would need to use: arcpy.Buffer_analysis.

So I setup an empty geometry to do the buffer in like so:

spatialRef = u"GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],\
           PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];\
           -450359962737.05 -450359962737.05 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision"

pointGeom = arcpy.PointGeometry(arcpy.Point(-27.607361, 152.768311), spatialRef)
temPol = arcpy.Geometry()

pol = arcpy.Buffer_analysis(pointGeom, temPol, "50 meters")[0]

The resulting Polygon object however, is a long thin line, rather than the expected circular polygon.

Any ideas what I am doing wrong?

5
  • What version of ArcMap are you using, and where/how are you defining spatialref?
    – Paul
    Commented Aug 5, 2014 at 14:36
  • @Paul : updated the question with the answers
    – James
    Commented Aug 5, 2014 at 14:38
  • You have your X,Y values flipped -- 152.8 degrees north is messing up the buffer.
    – Vince
    Commented Aug 5, 2014 at 14:49
  • Thanks. So Point expects lon, lat rather than lat, lon? I'm now getting polygons. But they are multisided, irregular polygons....I would've expected circles for a single point?
    – James
    Commented Aug 5, 2014 at 15:18
  • 2
    Point expects (x,y). Circles aren't circular in decimal degrees (which is a different question).
    – Vince
    Commented Aug 5, 2014 at 15:27

1 Answer 1

2

There are two things wrong here:

  1. The Point constructor takes arguments of X and Y, while you're providing Y (latitude) and X (longitude), resulting in an object above the north pole
  2. The XY precision you've defined in the spatialRef object is four decimal places (1/10000th of a degree), which is exceedingly coarse for a circle with a 50 meter radius -- an XY scale of 10,000 corresponds to roughly 11 meters (at the equator)

If you flip the lat and lon coordinates to lon,lat and add at least two places to your spatialRef (remembering to remove them from the origin -- change "-450359962737.05 -450359962737.05 10000" to "-4503599627.3705 -4503599627.3705 1000000" or simply "-400 -400 1000000"), you should get an appropriate polygon (which will not be circluar in an unprojected coordinate system, though it may seem so when close to the equator).

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.