Basically this module helps to speed up and to simplify the interaction with the ogr-API. Extremely convient if you want to save geomtries and their attributes to a GIS format.
Geometry class
fields is a tuple or list of field name and field type. Type can be
vertex_array is a tuple/list of tuples/lists with all coordinates making the line attr is tuple/list of tuples/lists. They are ordered by default, which means their realtionship to each other is best described by the index they share. Example:
attr = [[0,1,2,...],['heute','morgen','gestern',...]]
by setting the ordered argument to False it is also possible to pass the attributes unordered, which means their relationship is best described by the fact that they belong to the same row. Example:
attr = [(0,'heute'),(1,'morgen'),(2,'gestern'),...]
shape is filename of type .shp
shape is filename of type .shp
shape is filename of type .shp
Save a set of geo objects to a shapefile (or any other file format supported by ogr):
from ogr_utils.geometry import Geometry
g = Geometry( [(xy),], [(fieldname_1, type),(fieldname_2, type),], [(value_field_1,...),(value_field_2,...)] )
f = '/home/.../outfile.shp'
g.make_points(f)