filter out undrawable geometries
This commit is contained in:
parent
1ae60dba63
commit
627a31d3e3
1 changed files with 11 additions and 0 deletions
|
@ -201,6 +201,17 @@ class SVGImage:
|
||||||
# if altitude is set, the geometry will get a calculated shadow relative to the other geometries
|
# if altitude is set, the geometry will get a calculated shadow relative to the other geometries
|
||||||
# if elevation is set, the geometry will get a shadow with exactly this elevation
|
# if elevation is set, the geometry will get a shadow with exactly this elevation
|
||||||
|
|
||||||
|
# if fill_color is set, filter out geometries that cannot be filled
|
||||||
|
if fill_color is not None:
|
||||||
|
try:
|
||||||
|
geometry.geoms
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
geometry = type(geometry)(tuple(geom for geom in geometry.geoms if hasattr(geom, 'exterior')))
|
||||||
|
if geometry.is_empty:
|
||||||
|
pass
|
||||||
|
|
||||||
attribs = ' fill="'+(fill_color or 'none')+'"'
|
attribs = ' fill="'+(fill_color or 'none')+'"'
|
||||||
if fill_opacity:
|
if fill_opacity:
|
||||||
attribs += ' fill-opacity="'+str(fill_opacity)[:4]+'"'
|
attribs += ' fill-opacity="'+str(fill_opacity)[:4]+'"'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue