Ari Simmons
2014-06-09 22:55:35 UTC
This is my first time trying a cascaded_union, and I am getting the
following "..no len()..." error. I don't seem to have any 'NoneType'
geometry..so I'm not sure what it is picking up on...anybody else see it?
from shapely.geometry import shape
from shapely.ops import cascaded_union
def dissolve(inFile, outFile):
with fiona.open(inFile, 'r', encoding='utf-8') as input:
input_driver = input.driver
input_crs = input.crs
input_schema = input.schema.copy()
with fiona.open(outFile, 'w', driver=input_driver, crs=input_crs,
schema=input_schema, encoding='utf-8') as output:
for item in input:
geom = shape(item['geometry'])
dissolve_feat = cascaded_union(geom)
output.write({'geometry':mapping(dissolve_feat),
'properties': item['properties']})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20140609/2dd4584d/attachment.htm>
following "..no len()..." error. I don't seem to have any 'NoneType'
geometry..so I'm not sure what it is picking up on...anybody else see it?
File "<stdin>", line 1, in <module>
File "I:/It_25/116609_global_hwy_shields/dissolve/dissolve.py", line
17, in >>dissolveFile "I:/It_25/116609_global_hwy_shields/dissolve/dissolve.py", line
dissolve_feat = cascaded_union(geom)
File "C:\Python27\lib\site-packages\shapely\ops.py", line 112, in
cascaded_union
L = len(geoms)
TypeError: object of type 'LineString' has no len()
import fionaFile "C:\Python27\lib\site-packages\shapely\ops.py", line 112, in
cascaded_union
L = len(geoms)
TypeError: object of type 'LineString' has no len()
from shapely.geometry import shape
from shapely.ops import cascaded_union
def dissolve(inFile, outFile):
with fiona.open(inFile, 'r', encoding='utf-8') as input:
input_driver = input.driver
input_crs = input.crs
input_schema = input.schema.copy()
with fiona.open(outFile, 'w', driver=input_driver, crs=input_crs,
schema=input_schema, encoding='utf-8') as output:
for item in input:
geom = shape(item['geometry'])
dissolve_feat = cascaded_union(geom)
output.write({'geometry':mapping(dissolve_feat),
'properties': item['properties']})
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20140609/2dd4584d/attachment.htm>