Geospatial vector files published by Elastic for our users are created by mashing up vector data from OpenStreetMap and attribute data from Wikidata using Sophox. In this talk, I demonstrate how you can use Sophox and SPARQL queries to generate useful vector data and attributes.
2. 2
Agenda
About1
How we use Sophox at Elastic3
Wrap-Up4
Questions?5
Querying OpenStreetMap and Wikidata with Sophox2
3. 3
About me
• GIS Analyst and Software Engineer at Elastic (https://elastic.co)
• Elastic Maps Service and Kibana
• Previously GIS in local government
• @nickpeihl
Nick Peihl
Source: Gray Arial 10pt
4. 4
Agenda
About1
How we use Sophox at Elastic3
Wrap-Up4
Questions?5
Querying OpenStreetMap and Wikidata with Sophox2
5. 5
Sophox
● Created by Yuri Astrakhan (github.com/nyurik)
● Apache 2.0 OSS (github.com/sophox)
● Built upon Wikidata Query Service (query.wikidata.org)
● Hosted for the community by Elastic
OpenStreetMap RDF Query Tool (SPARQL)
10. 10
Sophox SPARQL Example
List OSM objects with a place tag
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place ?place .
} LIMIT 50
Try me
11. 11
Sophox SPARQL Example
List OSM objects with a place tag = island
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
} LIMIT 50
Try me
13. 13
Sophox SPARQL Example
List OSM objects with a place tag = island
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
} LIMIT 50
Try me
14. 14
Sophox SPARQL Example
List OSM objects with a place tag = island
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
} LIMIT 50
Try me
16. 16
Sophox SPARQL Example
List OSM objects with a place tag = island
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
} LIMIT 50
Try me
17. 17
Sophox SPARQL Example
List OSM objects with a place tag = island
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
SERVICE <https://query.wikidata.org/sparql> {
?wikidataId wdt:P1082 ?population
}
} LIMIT 50
Try me
19. 19
Sophox SPARQL Example
List OSM objects with a place tag = island
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
SERVICE <https://query.wikidata.org/sparql> {
?wikidataId wdt:P1082 ?population
}
} LIMIT 50
Try me
20. 20
Sophox SPARQL Example
List OSM objects with a place tag = island and population <= 100
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
SERVICE <https://query.wikidata.org/sparql> {
?wikidataId wdt:P1082 ?population
}
FILTER(?population > 0 && ?population <= 100)
} LIMIT 50
Try me
22. 22
Sophox SPARQL Example
List OSM objects with a place tag = island and population <= 100
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
SERVICE <https://query.wikidata.org/sparql> {
?wikidataId wdt:P1082 ?population
}
FILTER(?population > 0 && ?population <= 100)
} LIMIT 50
Try me
23. 23
Sophox SPARQL Example
Map OSM objects with a place tag = island and population <= 100
#defaultView:Map
SELECT * WHERE {
?osmId osmm:type ?osmType .
?osmId osmt:place 'island' .
?osmId osmt:name ?osmName .
?osmId osmt:wikidata ?wikidataId .
?osmId osmm:loc ?wkt .
SERVICE <https://query.wikidata.org/sparql> {
?wikidataId wdt:P1082 ?population
}
FILTER(?population > 0 && ?population <= 100)
} LIMIT 50
Try me