You can also create a geometry by passing in GeoJSON to OGR, which saves space compared to the first example:
In: from osgeo import ogr geojson = """{"type":"Polygon","coordinates":[[[1,1],[5,1], [5,5],[1,5], [1,1]]]}""" polygon = ogr.CreateGeometryFromJson(geojson) print(polygon) Out: POLYGON ((1 1,5 1,5 5,1 5,1 1))