OpenStreetMap logo OpenStreetMap

IrdiIs's Diary Comments

Diary Comments added by IrdiIs

Post When Comment
Day 23 - Village Vesqi

Thank you!!

Day 14 - Village Lapulec

Thanks a lot! Will try on next diary entries.

Day 18 - Villages Frashër and Jaran

Welcome Nicolas and enjoy your OSM journey. Feel free to reach out if you need help with anything.

100 villages in 100 days

It is going good so far and has also inspired me to map in the surrounding countries. Thank you very much!

Day 12 - Villages Lavdar i Korçës and Polenë

Thanks for the tip. I will add it from now on.

Day 10 - Village Kastriot

Oh, cheers for your project too. I read your diary and that is absolutely amazing!

Day 10 - Village Kastriot

I will definitely watch some tutorials for JOSM, but I do not have time to start something new right now. Thanks a lot for offering to help, though. I will keep it in mind.

Day 10 - Village Kastriot

Thanks a lot for the tip. I will also add residential area to the villages i map now.

Day 10 - Village Kastriot

So far I am enjoying exploring Albanian villages from the top. Thanks a lot farhadGuli and I will keep it in mind your offer for help. Feel free to reach out if you need help too!

Day 9 - Village Stropckë

Oh, thanks a lot! I am well, actually. Had planned a Sunday at the river with friends but did not want to skip the village for today. “Hugs”

100 villages in 100 days

That bot is very cool! Do you think I could adapt it for Albania, even though our population statistics are not that good on OSM?

100 villages in 100 days

I have just started exploring overpass turbo so there might be better solutions for this but im enjoying exploring. I am sharing below the overpass query and the python script:

Overpass query

[out:json];
area["ISO3166-1"="AL"]->.searchArea;
(
  node["place"="village"](area.searchArea);
);
out body;

In the query, “AL” represents Albania. You can replace “AL” with the ISO 3166-1 code for any other country to get results specific to that country.

After i ran the query, i exported the data in .geojson format and then used the python script. It might not be the best, but it did the job.

Python script (select_random_villages.py) to randomly select 100 villages from a .geojson file.

Python script

import json
import random

#Load the GeoJSON data
with open('export.geojson', 'r', encoding='utf-8') as f:
    data = json.load(f)

#Extract the village features
villages = [feature for feature in data['features'] if feature['properties'].get('place') == 'village']

#Select 100 random villages
random_villages = random.sample(villages, 100)

#Create a list of village names and coordinates
village_info = [
    {
        'name': village['properties'].get('name', 'Unnamed village'),
        'latitude': village['geometry']['coordinates'][1],
        'longitude': village['geometry']['coordinates'][0]
    }
    for village in random_villages
]

#Save the selected random village names and coordinates to a text file
with open('random_villages.txt', 'w', encoding='utf-8') as f:
    for info in village_info:
        f.write(f"Name: {info['name']}, Latitude: {info['latitude']}, Longitude: {info['longitude']}\n")

#Print the selected random village names and coordinates (optional)
for info in village_info:
    print(f"Name: {info['name']}, Latitude: {info['latitude']}, Longitude: {info['longitude']}")

On the line “#Load Json data” you have to give the filename of the extracted .geojson data. In my case is ‘export.geojson’. If the file is located in a different directory from the script, include the path to the .geojson file.