Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Suppose I have a dataset where each record has an x,y and r (the centroid and radius of a circle). How can I create a polygon feature class containing parametric circles?

Sorry to those who have a great open source solution, but I'm stuck using python in ArcGIS 10.

share|improve this question
2  
Multiply the arcpy by the radius? –  Jay Cummins Jan 28 '11 at 1:14
    
Are you making a distinction between "circle" and "parametric circle"? If so, what is it? –  whuber Jan 28 '11 at 3:54
    
@whuber - I wanted to be clear I am not looking for what use to pass for a circle in ArcMap (an n sided polygon approximation) like the answer by Dan S. –  Regan Sarwas Jan 28 '11 at 16:00

3 Answers 3

up vote 4 down vote accepted

You could create a buffer around the point using the buffer command. For example in 10.0 using arcpy.Buffer_analysis() (see ArcGIS help), and use the radius as the buffer distance.

share|improve this answer
    
I tried this but circle = arcpy.buffer(center_point, empty_geom, r) is 1000x more expensive than poly = arcpy.Polygon(arcpy.array([pt1,pt2, ...]). If you inspect the circle that comes back from buffer command you can see it is a polygon with two points, both at the top of the circle. I wonder if there is a way to create the circle with the arcy.polygon command. –  Regan Sarwas Jan 28 '11 at 16:06
    
@Regan -- I peeked at the documentation for arcpy.Polygon and it looks like it'd be easy to work w/ my code below: arcpy.Polygon(arcpy.array([ [px,py] for (px,py) in circle_poly(center_point.x,center_point.y,r) ])). (Note this is a polygon with 100 straight-line sides approximating a circle, not an actual circle. Tweak accordingly.) –  Dan S. Jan 29 '11 at 20:06
    
@Dan, Thanks. I posted a timing comparison as a comment on your answer. and your solution is faster. Unfortunately my user has an allergy to all those vertices. –  Regan Sarwas Jan 31 '11 at 17:52

You could throw together a model to do this in ArcMap. First create an XY layer from your table to get a point feature class, then run buffer on it against the radius field.

share|improve this answer
    
I like this, it may not be the fastest solution (I'm still hoping for an answer to my comment on Celenius' answer), but will be simpler to maintain than writing my own script. –  Regan Sarwas Jan 28 '11 at 16:12

The other answers are probably better for your environment, but there's no need to fear a tiny bit of trig, and something like below will work equally well in all (python) environments.

import math
def circle_poly(x,y,r): 
    for i in range(100):
        ang = i/100 * math.pi * 2
        yield (x + r * math.cos(ang), y + r * math.sin(ang) )

(However, you may have cause to fear the arcpy API required to assemble polygon objects from point data. I haven't had to tackle it yet. :)

You may find this question/my answer interesting if you need circle to truly represent equal distances around the point.

share|improve this answer
    
I timed this against the buffer solution, and with 50 sides (I think this is what ESRI uses for a default), this solution is 15 times faster, although it does consume considerably more storage space. I don't know which draws faster. –  Regan Sarwas Jan 31 '11 at 17:48
    
@Regan -- I'm glad it worked, at least! ;) I'd be curious to see if there's any difference in storage space if both are converted to a shapefile (which, unless I'm wrong, will force a conversion of any curves into straight lines). –  Dan S. Jan 31 '11 at 23:02
    
you were right, exporting to shapefile creates a 70 sided polygon, but it is only about 5x the storage space of a file geodatabase feature class (as reported by ArcCatalog). –  Regan Sarwas Feb 3 '11 at 20:37
    
you might need to use ang = float(i)..... –  Stephen Lead Sep 2 at 3:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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