
Scrape openstreetmap.org for the data to drive a locations API.
- or -
Post a project like this817
$200
- Posted:
- Proposals: 11
- Remote
- #3994035
- OPPORTUNITY
- Awarded
Digital Solutions|Designer & Developer|Shopify|WordPress|SEO|Data Scraping|Lead Generation|Animation

Top-Rated Video Editor | Graphic Designer | Motion Graphics Expert | Adobe Premiere Pro & After Effects Specialist

WordPress Expert | Web & App Developer | SEO Specialist | Content Writer | Blockchain | Python | OpenAI | Machine Learning

Full Stack Dot Net Developer | LinkedIn Lead Expert| Senior Web Developer |Python | API Expert |WordPress Developer | Angular | SQL | MS AZURE

95537463811478354499230155498146356315100566081739130405984129512859198900959





Description
Experience Level: Entry
I'm building a simple locations API which needs:
1. a list of all the world's Countries, (237: I have a list of 237 countries if you need it)
2. the states/provinces/regions within each country (>14,000)
3. the cities within each state/province/region (unknown amount)
openstreetmap.org offers its 128GB full world database for free at https://planet.openstreetmap.org/
Or more simply, a read-only "Overpass API" which can request the data of all countries, their states/provinces/regions, and their cities, with the data being relational:
Google Bard (below) explained that this is possible but I need someone to execute this properly.
Code snippet example
[out:json];
area["ISO3166-1"="*"];
(
rel(area);
->.admin_level;
->.name;
);
out;
Use code with caution. Learn more
This query will first select all areas with an ISO 3166-1 code. It will then iterate over each area and extract the area's admin_level and name. The admin_level property is a number that indicates the level of administrative subdivision of the area. For example, the admin_level of a country is 1, the admin_level of a state is 2, and the admin_level of a city is 4.
The query will then output the JSON data for each area, including the area's admin_level and name. The data will be relational, as each state object will have a country: id property, and each city object will have a region: id property.
To run this query, you can use the Overpass API Explorer. You can also use a command-line tool like Overpass Turbo: https://overpass-turbo.eu/ to run the query.
Here is an example of the JSON data that the query will output:
JSON
{
"id": "1",
"admin_level": 1,
"name": "United States"
},
{
"id": "2",
"admin_level": 2,
"name": "California",
"country": "1"
},
{
"id": "3",
"admin_level": 4,
"name": "Los Angeles",
"region": "2"
}
As you can see, the JSON data for each area includes the area's id, admin_level, and name. The data also includes a country property for each state object, and a region property for each city object.
1. a list of all the world's Countries, (237: I have a list of 237 countries if you need it)
2. the states/provinces/regions within each country (>14,000)
3. the cities within each state/province/region (unknown amount)
openstreetmap.org offers its 128GB full world database for free at https://planet.openstreetmap.org/
Or more simply, a read-only "Overpass API" which can request the data of all countries, their states/provinces/regions, and their cities, with the data being relational:
Google Bard (below) explained that this is possible but I need someone to execute this properly.
Code snippet example
[out:json];
area["ISO3166-1"="*"];
(
rel(area);
->.admin_level;
->.name;
);
out;
Use code with caution. Learn more
This query will first select all areas with an ISO 3166-1 code. It will then iterate over each area and extract the area's admin_level and name. The admin_level property is a number that indicates the level of administrative subdivision of the area. For example, the admin_level of a country is 1, the admin_level of a state is 2, and the admin_level of a city is 4.
The query will then output the JSON data for each area, including the area's admin_level and name. The data will be relational, as each state object will have a country: id property, and each city object will have a region: id property.
To run this query, you can use the Overpass API Explorer. You can also use a command-line tool like Overpass Turbo: https://overpass-turbo.eu/ to run the query.
Here is an example of the JSON data that the query will output:
JSON
{
"id": "1",
"admin_level": 1,
"name": "United States"
},
{
"id": "2",
"admin_level": 2,
"name": "California",
"country": "1"
},
{
"id": "3",
"admin_level": 4,
"name": "Los Angeles",
"region": "2"
}
As you can see, the JSON data for each area includes the area's id, admin_level, and name. The data also includes a country property for each state object, and a region property for each city object.

John G.
100% (11)Projects Completed
8
Freelancers worked with
6
Projects awarded
60%
Last project
13 Mar 2024
United States
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies