I'm not the only one simplifying terrible Python APIs in the geospatial world. Yesterday, I ran across a blog post about software named pygp. Very much about ArcGIS records and fields, it models data differently than Fiona does but similarly eliminates a lot of boilerplate and provides simple access to all coordinates of a record's shape field.
def example_geometry(path): """ Example showing use of Geometry helper class that does the heavy lifting on the geometry object and returns something quite similar to WKT/GeoJSON Structure is simple, a tuple of tuple of Point objects, very similar to Avenue days of geometry and WKT MultiLineString etc. (((0, 498266, 6100519, None, None), (0, 499775, 6100281, None, None), (0, 500224, 6098694, None, None), (0, 499616, 6097662, None, None), (0, 498346, 6096789, None, None))) :param path: Workspace Path :type path: str """ feature_class = FeatureClass(osjoin(path, POLYGON)) for srow in feature_class.search(): print srow.get_value( feature_class.shape_field_name).as_tuple() # End example_geometry function
I don't know whether pygp has eliminated the need to count references to cursors and records or just omitted
from the example. I'd have looked in the code, but I couldn't find a link. I bet a lot of people would love to see it on GitHub.
Comments are closed after 13 days.