sparqlunicorn / sparqlunicornGoesGIS

SPARQLing Unicorn QGIS Plugin (Documentation: https://sparqlunicorn.github.io/sparqlunicornGoesGIS/)
https://plugins.qgis.org/plugins/sparqlunicorn/
GNU General Public License v2.0
27 stars 6 forks source link

Adding BoundingBox constraint throws Exceptions #24

Closed rduivenvoorde closed 3 years ago

rduivenvoorde commented 3 years ago

Thanks for adding the NL Basisregistratie endpoints !

When I select one of the NL Basisregistratie endpoints, then just take the vanilla query template, and then try to add a BoundingBox constraint, I get the following exception if I choose 'Apply BBOX':

Traceback (most recent call last):
  File "/home/richard/.local/share/QGIS/QGIS3/profiles/default/python/plugins/sparqlunicornGoesGIS-master/bboxdialog.py", line 64, in setBBOXInQuery
    pointt1=QgsGeometry.fromWkt(self.rect_tool.point1.asWkt())
AttributeError: 'str' object has no attribute 'asWkt'

or if I choose 'Apply Layer extent':

AttributeError: 'QgsRasterLayer' object has no attribute 'sourceCrs' 
Traceback (most recent call last):
  File "/home/richard/.local/share/QGIS/QGIS3/profiles/default/python/plugins/sparqlunicornGoesGIS-master/bboxdialog.py", line 50, in setBBOXExtentQuery
    self.setBBOXInQuery()
  File "/home/richard/.local/share/QGIS/QGIS3/profiles/default/python/plugins/sparqlunicornGoesGIS-master/bboxdialog.py", line 62, in setBBOXInQuery
    sourceCrs = QgsCoordinateReferenceSystem(self.mts_layer.sourceCrs())
AttributeError: 'QgsRasterLayer' object has no attribute 'sourceCrs'

Also tried a vector (point and polygon) layer, but get about the same error:

AttributeError: 'str' object has no attribute 'asWkt' 
Traceback (most recent call last):
  File "/home/richard/.local/share/QGIS/QGIS3/profiles/default/python/plugins/sparqlunicornGoesGIS-master/bboxdialog.py", line 64, in setBBOXInQuery
    pointt1=QgsGeometry.fromWkt(self.rect_tool.point1.asWkt())
AttributeError: 'str' object has no attribute 'asWkt'`

All on current master and latest version of the plugins.

situx commented 3 years ago

Thank you for the hint. I pushed a fix to the master branch. This dialog is still in development and will be updated for the next release. In particular, a CRS system should be selected for the bounding box as not all bounding boxes are defined in WGS84 and finding a more generic way to include a bounding box query into the SPARQL dialog as it may vary across triple store implementations. Further optimizations would include entering a placename and retrieving its bounding box, but probably not in the next release. Let me know if the fix works for you.

situx commented 3 years ago

Should be fixed in version 0.12