GeoCat / bridge-style

Cartography library making style format conversions as easy as using Python.
MIT License
45 stars 14 forks source link

angle error on line style (sld) #12

Open pvgenuchten opened 5 years ago

pvgenuchten commented 5 years ago

this line style has a marker with some rotation

rotation-on-linemarker.qgz.zip

this causes the following error on bridge-style

KeyError: 'angle' 
Traceback (most recent call last):
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 49, in processLayer
    rules.append(processRule(rule))
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 199, in processRule
    symbolizers = _createSymbolizers(rule.symbol().clone())
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 296, in _createSymbolizers
    symbolizer = _createSymbolizer(sl, opacity)
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 322, in _createSymbolizer
    symbolizer = _rasterImageMarkerSymbolizer(sl, opacity)
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 404, in _rasterImageMarkerSymbolizer
    marker = _basePointSimbolizer(sl, opacity)
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 417, in _basePointSimbolizer
    rotation = _symbolProperty(sl, "angle", QgsSymbolLayer.PropertyAngle)
  File "/Users/geocat/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/geocatbridge/libs/bridgestyle/bridgestyle/qgis/togeostyler.py", line 278, in _symbolProperty
    v = symbolLayer.properties()[name]
KeyError: 'angle'

I'm not sure the feature is critical to support, but if used it should not throw a key error and fail the conversion.

volaya commented 5 years ago

I created a layer with image markers and rotation, and it works fine. This should be fixed already.

The linked project does not have image markers, but instead a line line with symbols, which is not yet supported.

pvgenuchten commented 5 years ago

this indeed is a marker line style, which usually works fine, but not for this case, to consider is to put the angle to 0, and not cause an error if angle is used.