Why not ask your question on the new OpenStreetMap Community Forum?

I've just discovered this new Sophox API.

I would to get all cities (place=city) in the Arab World. I assume that it would be much easier to query for this using Wikidata than filtering the global dump.

The arab countries have the following Wikidata IDs: Q79 Q262 Q1049 Q796 Q1028 Q851 Q805 Q858 Q1045 Q948 Q878 Q810 Q1016 Q1176995 Q822 Q842 Q817 Q1025 Q846 Q398 Q977 Q970

Is this possible and how would it look like? Thanks in advance.

asked 03 Jul '18, 20:14

Nehaj's gravatar image

accept rate: 0%

updated my reply with an example

(28 Nov '18, 18:58) nyuriks

Nehaj, updating my reply. Sophox is back up. Here's a sample query, but unfortunately it is very slow - I suspect it needs some federated query optimizations:

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>

  VALUES ?countries { wd:Q79 wd:Q262 wd:Q1049 wd:Q796 wd:Q1028 wd:Q851 wd:Q805 wd:Q858 wd:Q1045 wd:Q948 wd:Q878 wd:Q810 wd:Q1016 wd:Q1176995 wd:Q822 wd:Q842 wd:Q817 wd:Q1025 wd:Q846 wd:Q398 wd:Q977 wd:Q970 }

  ?osmid osmt:place "city" ;
         osmt:wikidata ?wd .

  SERVICE <https://query.wikidata.org/sparql> {
    ?wd wdt:P17 ?countries .

} limit 10
permanent link

answered 05 Jul '18, 07:26

nyuriks's gravatar image

accept rate: 0%

edited 28 Nov '18, 18:56

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 03 Jul '18, 20:14

question was seen: 1,607 times

last updated: 28 Nov '18, 18:58

powered by OSQA