# Create a shapefile from geometry

Please excuse my lingo, I am still learning some aspects of geo spatial and arcpy.

I have a python script that takes a shapefile. The shapefile consists of a polyline. I have traversed the polyline, done some interpolation and retrieved some points. Long story short, I'm trying to generate polygons along the polyline based on intervals of the M values. These polygons have four points (my geometries).

How can I take these geometries, or points, that are in my python script and output them into a shapefile. I know I'll have to pass my points to a function that produces a shapefile, but that is my dilemma. How exaclty do I create the function that creates my shapefile for the geometries?

-
I added the polygon-creation tag to help you find related threads. A search turns up some promising ones, especially the Python code found at gis.stackexchange.com/questions/21443/…. Would that perhaps answer your question? – whuber Feb 8 '13 at 20:47

import arcpy
coords = [(1, 2), (3, 4), (5, 6), (7, 8)]
ar = arcpy.Array()
for x, y in coords:

If you needed to add additional fields, etc, it'd be a little more complex and involve a call to CreateFeatureclass and as many AddField calls as necessary to get the columns you'd need, and then an InsertCursor to insert the values. – Jason Scheirer Feb 11 '13 at 16:14