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

Allow to get geoshape #26

Open bellerophons-pegasus opened 3 years ago

bellerophons-pegasus commented 3 years ago

Not sure if #9 already has this covered, so apologies if this is a duplicate.

I was playing around with this query on Wikidata that gives me the areas of Austrian states:

SELECT ?geo ?layer WHERE {
  ?district wdt:P31/wdt:P279* wd:Q261543 ;
            wdt:P17 wd:Q40 ;
            wdt:P3896 ?geo .
  ?district rdfs:label ?labels .
  FILTER(LANG(?labels) = "en")
  BIND (?labels AS ?layer)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }

Then I tried to insert the query in the plugin and it (obviously) didn't work, because only points are currently supported? It would be nice to also be able to get shapes of whole areas.

situx commented 3 years ago

We have not (yet) included support for geoshapes. We currently only support GeoSPARQL literals with Polygons e.g. WKT. The problem with geoshapes is that they are not available in the Wikidata graph. Instead, a link to a geoshape is given in the Wikidata graph which needs to be resolved by the plugin. This is currently not implemented. Another problem is that geoshapes can include arbitrary featurecollections. It is possible to extract the geometries from the featurecollections and to return them in the query, but maybe a user wants to access attributes of this featurecollection as well. Hence, probably a merging of the contents of a geoshape featurecollection with the query result is a way to go.

situx commented 3 years ago

image

I added some preliminary support in the master branch. Needs more testing though

florianthiery commented 2 years ago

same issue here: https://w.wiki/4pDu - but now solved, thx @situx :-)