Check the Setup
- Python 3.10 or newer
- An internet connection and about 20 MB of free disk space
- The requests and osmium Python packages
Daily regional OpenStreetMap PBF extracts from Geofabrik for building local place search, road networks, and other geographic products.
Report a ProblemFrom Source to Product Signal
Geofabrik republishes regional OpenStreetMap extracts as PBF files. Start with Prince Edward Island rather than a national file and count road ways. The extract is a dated community map, not a complete or authoritative road inventory.
Install the packages, then run the notebook cell.
python -m pip install requests osmium
from pathlib import Path
import osmium
import requests
url = "https://download.geofabrik.de/north-america/canada/prince-edward-island-latest.osm.pbf"
path = Path("prince-edward-island-latest.osm.pbf")
with requests.get(url, stream=True, timeout=60) as response:
response.raise_for_status()
with path.open("wb") as output:
for chunk in response.iter_content(chunk_size=1024 * 1024):
output.write(chunk)
class RoadCounter(osmium.SimpleHandler):
def __init__(self):
super().__init__()
self.count = 0
def way(self, way):
if "highway" in way.tags:
self.count += 1
roads = RoadCounter()
roads.apply_file(str(path))
print(f"{roads.count} mapped road ways in this dated extract")Test a Useful Signal
Check whether one small OSM extract can support a local route-planning prototype.
Geofabrik GmbH and OpenStreetMap contributors is a community source. Last verified 2026-09-28. Temporal coverage: current regional extracts with dated archives.