Difference between revisions of "OSM Planet"
Jump to navigation
Jump to search
Line 87: | Line 87: | ||
|} | |} | ||
− | == | + | <source lang='bash' highlight='1'> |
− | + | sparqlquery -qp osmplanet.yaml -qn RelationPredicates -en osm-sophox --param relid=6843452,limit=50 -f mediawiki | |
+ | </source> | ||
+ | == RelationPredicates == | ||
+ | |||
+ | === query === | ||
+ | <source lang='sparql'> | ||
+ | # Get all predicates and objects for an OSM relation | ||
+ | PREFIX osmrel: <https://www.openstreetmap.org/relation/> | ||
+ | SELECT * | ||
+ | WHERE { | ||
+ | osmrel:6843452 ?p ?o . | ||
+ | } | ||
+ | LIMIT 50 | ||
+ | |||
+ | </source> | ||
+ | |||
+ | [https://sophox.org?query=%23%20Get%20all%20predicates%20and%20objects%20for%20an%20OSM%20relation%0APREFIX%20osmrel%3A%20%3Chttps%3A//www.openstreetmap.org/relation/%3E%0ASELECT%20%2A%0AWHERE%20%7B%0A%20%20osmrel%3A6843452%20%3Fp%20%3Fo%20.%0A%7D%0ALIMIT%2050%0A try it!] | ||
+ | === result === | ||
+ | {| class="wikitable" style="text-align: left;" | ||
+ | |+ <!-- caption --> | ||
+ | |- | ||
+ | ! p !! o | ||
+ | |- | ||
+ | | https://wiki.openstreetmap.org/wiki/Key:network:wikidata || http://www.wikidata.org/entity/Q2842994 | ||
+ | |- | ||
+ | | https://wiki.openstreetmap.org/wiki/Key:operator:wikidata || http://www.wikidata.org/entity/Q2476154 | ||
+ | |- | ||
+ | | https://wiki.openstreetmap.org/wiki/Key:operator:wikipedia || https://es.wikipedia.org/wiki/Renfe | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/type || r | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/node/29567894 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/node/29569297 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/node/1697798338 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/node/1981635686 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4397369 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4647707 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4647734 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648675 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648725 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648757 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648758 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648759 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648760 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648761 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648799 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648805 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648806 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648807 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648808 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648809 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648825 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648826 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/4648846 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/23191954 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/23360874 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/23487703 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/23487816 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/31129033 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/31129034 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/34062595 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/34062596 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41556789 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41556790 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41556954 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41556955 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41557267 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41557268 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41557269 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41645076 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41645077 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41646184 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41646185 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41910949 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41910950 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/41911087 | ||
+ | |- | ||
+ | | https://www.openstreetmap.org/meta/has || https://www.openstreetmap.org/way/43908973 | ||
+ | |} | ||
== See Also == | == See Also == |
Revision as of 10:25, 20 January 2025
OSM Planet SPARQL Endpoints
This page compares the different SPARQL endpoints available for querying OpenStreetMap (OSM) data.
Configuration for pylodstorage sparqlquery tool
see https://pypi.org/project/pyLodStorage/
installation
pip install pylodstorage
The configuration files need to be in $HOME/.pylodstorage or you have to explicitly give the path with the -ep and -qp options
endpoints.yaml
osm-sophox:
endpoint: https://sophox.org/sparql
website: https://sophox.org
database: virtuoso
method: POST
lang: sparql
prefixes: |
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
osm-qlever:
endpoint: https://qlever.cs.uni-freiburg.de/api/osm
website: https://qlever.cs.uni-freiburg.de/osm
database: qlever
method: POST
lang: sparql
prefixes: |
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
osmplanet.yaml (or queries.yaml as default)
RelationStats:
endpoint: osm-qlever
param_list:
- name: relid
type: str
default_value: "6843452"
sparql: |
# Get statistics about predicates used in an OSM relation
SELECT ?p (COUNT(?o) as ?count)
WHERE {
osmrel:{{relid}} ?p ?o .
}
GROUP BY ?p
HAVING (?count > 1)
ORDER BY DESC(?count)
Query Results
Sophox Queries
sparqlquery -qp osmplanet.yaml -qn RelationStats -en osm-sophox --param relid=6843452 -f mediawiki
RelationStats
query
# Get statistics about predicates used in an OSM relation
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
SELECT ?p (COUNT(?o) as ?count)
WHERE {
osmrel:6843452 ?p ?o .
}
GROUP BY ?p
HAVING (?count > 1)
ORDER BY DESC(?count)
result
p | count |
---|---|
https://www.openstreetmap.org/meta/has | 186 |
sparqlquery -qp osmplanet.yaml -qn RelationPredicates -en osm-sophox --param relid=6843452,limit=50 -f mediawiki
RelationPredicates
query
# Get all predicates and objects for an OSM relation
PREFIX osmrel: <https://www.openstreetmap.org/relation/>
SELECT *
WHERE {
osmrel:6843452 ?p ?o .
}
LIMIT 50