How to take Egypt Data

How to take all the name of Provinces and its cities, Districts, Sub districts in Egypt Data

In what format do you need the output? Do you need just the names, or also the geometries of their boundaries?

just names only

i need json or excel format

This Overpass query should work, but it looks like I’m missing something. You can try it on Overpass Turbo and see if it gives you any results.

It should return a CSV with the name and administrative level.

admin_level is 4 for provinces, 8 for cities; higher values are for divisions/sub-divisions.

[out:csv(::id, name, admin_level)][timeout:25];
relation["name:en"="Egypt"]["boundary"="administrative"]->.country;
(
  relation["boundary"="administrative"]["name"](area.country);
);
out body;

its showing nothing

Try with this one, this should give you all results in json format:

[out:json][timeout:25];
area["ISO3166-1"="EG"]->.country;
(
  relation(area.country)["boundary"="administrative"]["name"];
);
out skel;

its not showing the names, only digits

Sorry, last line should read out tags; (not out skel;)

An error occurred during the execution of the overpass query! This is what overpass API returned:

Error: line 6: parse error: Unknown type “not”

Error: line 6: parse error: An empty query is not allowed

Error: line 6: parse error: ‘;’ expected - ‘out’ found.

Error: line 6: parse error: ‘;’ expected - ‘)’ found.

Error: line 6: parse error: Unexpected end of input.

I think you misunderstood part of the last line posted by @GeoDeskTeam that was intended as explanation, not code. So the full code would be

[out:json][timeout:25];
area["ISO3166-1"="EG"]->.country;
(
  relation(area.country)["boundary"="administrative"]["name"];
);
out tags;
2 Likes

i need every Provinces name and its Cities, Districts, Sub districts in order

Have you tried anything at all by yourself? These short answers come off to me as impatient and demanding. Keep in mind nobody here is being paid and everybody is doing this in their free time.

You should show that you are willing to do something by yourself as well, not just demanding stuff. This also includes a better description of what you need (and maybe even what for). Also, a “Hello” and a “please” and “all the best” would go a long way.

If you need a pointer on how to do ask better questions - How To Ask Questions The Smart Way could be of help :slight_smile:

5 Likes

I would highly recommend a tool such as ChatGPT/Gemini/CoPilot/whatever LLM. For this type of needs, it results incredibly well, with the advantage you can refine your demands.

…also, it does not complain when you go demanding or impatient on it, unlike our human replacements. :yum:

In Egypt only admin_level=4 boundaries are mapped.

With this query you get a CSV-list of these boundaries:

and with this query you see them in the map:

2 Likes

There are a few lower-level admin areas (but only around Cairo).

The entry for Egypt on the Wiki page for boundary=administrative is incomplete.