twhiteaker / CFGeom

CF Convention for Representing Simple Geometry Types
MIT License
9 stars 4 forks source link

Return nested list/tuples from "loads" #15

Closed bekozi closed 7 years ago

bekozi commented 8 years ago

The Python cf.loads function should return nested list/tuples. shapely objects should be returned from a separate function that accepts the output from the new cf.loads implementation. The shapely function should be named differently to prevent conflicting imports.

This will make the implementation more general and not rely on an external package if we want to add things like parametric objects (#8).

twhiteaker commented 7 years ago

As of 1592735e630d26a2280abc88e52c399ea89ee394, we have a loads_from_netcdf function at https://github.com/twhiteaker/netCDF-CF-simple-geometry/blob/master/src/python/ncsg/cf.py#L189 which reads geometries from netCDF into a tuple of CFGeometryCollection objects defined at https://github.com/twhiteaker/netCDF-CF-simple-geometry/blob/master/src/python/ncsg/geometry/base.py#L19. CFGeometryCollection includes a list of geometries, where each geometry is just a list of dictionaries representing the geometry's parts. Then there is a to_shapely function at https://github.com/twhiteaker/netCDF-CF-simple-geometry/blob/master/src/python/ncsg/cf.py#L96 to convert a given geometry to a shapely geometry.