organicmaps: Unable to run map_generator on osm.pbf and o5m extract files

I am trying to run maps_generator on a small extract of the Yukon Territories, Canada from Geofabrik. What am I doing wrong?

https://osm-internal.download.geofabrik.de/north-america/canada/yukon.html

I am running the following command.

python -m maps_generator --countries="World, WorldCoasts, Yukon_North, Yukon_Whitehorse"

Getting this error:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/opt/homebrew/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/Users/n/code/organicmaps/tools/python/maps_generator/maps_generator.py", line 6, in <module>
    from maps_generator.generator import stages_declaration as sd
  File "/Users/n/code/organicmaps/tools/python/maps_generator/maps_generator.py", line 6, in <module>
    from maps_generator.generator import stages_declaration as sd
ModuleNotFoundError: No module named 'maps_generator.generator'; 'maps_generator' is not a package

MacBookAir10,1 macOS 13.1 Ventura Python 3.10.9

Using this for an ini:

[Main]
# If the flag DEBUG is set a special small planet file will be downloaded.
DEBUG: 0
# The path where the planet will be downloaded and the maps are generated.
MAIN_OUT_PATH: ~/maps_build
# The path where caches for nodes, ways, relations are stored.
# CACHE_PATH:


[Developer]
# The path where the generator_tool will be searched.
BUILD_PATH: ~/code/omim-build-release
# The path to the project directory omim.
OMIM_PATH: ~/code/organicmaps


[Generator tool]
# The path to the omim/data.
USER_RESOURCE_PATH: ${Developer:OMIM_PATH}/data
# Do not change it. This is determined automatically.
# NODE_STORAGE: map


[Osm tools]
# The path to the osmctools sources.
OSM_TOOLS_SRC_PATH: ${Developer:OMIM_PATH}/tools/osmctools
# The path where osmctools will be searched or will be built.
OSM_TOOLS_PATH: ~/osmctools


[Stages]
# Run osmupdate tool for planet.
NEED_PLANET_UPDATE: 0
# Auto detection.
THREADS_COUNT_FEATURES_STAGE: 0
# If you want to calculate diffs, you need to specify, where old maps are
DATA_ARCHIVE_DIR: ${Generator tool:USER_RESOURCE_PATH}
# You may specify, how many versions in the archive to use for diff calculation
DIFF_VERSION_DEPTH: 2


[Logging]
# The path where maps_generator log will be saved.
# LOG_FILE_PATH: generation.log


[External]
# Note: If you want to set a directory name you have to add "/" to the end of url.
# In each field where you need to specify a URL, you can specify the path to the file system using file:///path/to/file

# The url to the planet file.
PLANET_URL: file:///opt/geodata/yukon.osm.pbf
# The url to the file with md5 sum of the planet.
PLANET_MD5_URL: file:///opt/geodata/yukon.osm.pbf.md5
# The base url to WorldCoasts.geom and WorldCoasts.rawgeom (without file name).
# Files latest_coasts.geom and latest_coasts.rawgeom must be at this URL.
# For example, if PLANET_COASTS_URL = https://somesite.com/download/
# The https://somesite.com/download/latest_coasts.geom url will be used to download latest_coasts.geom and
# the https://somesite.com/download/latest_coasts.rawgeom url will be used to download latest_coasts.rawgeom.
# PLANET_COASTS_URL:
# Set to 'true' to build special routing section in World.mwm for alerting about absent regions without which the
# route can't be built.
NEED_BUILD_WORLD_ROADS: true
# The url to the subway file.
SUBWAY_URL: https://cdn.organicmaps.app/subway.json

# The url of the location with the transit files extracted from GTFS.
# TRANSIT_URL:

# Urls for production maps generation.
# UGC_URL:
# HOTELS_URL:
# PROMO_CATALOG_CITIES:
# POPULARITY_URL:
# FOOD_URL:
# FOOD_TRANSLATIONS_URL:
# SRTM_PATH:
# ISOLINES_PATH:
# UK_POSTCODES_URL:
# US_POSTCODES_URL:


[Common]
# Auto detection.
THREADS_COUNT: 0


[Stats]
# Path to rules for calculating statistics by type
STATS_TYPES_CONFIG: ${Developer:OMIM_PATH}/tools/python/maps_generator/var/etc/stats_types_config.txt

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

Success!

woo 🥳

How do I open a specific MWM file in the desktop app?

the desktop app uses a symlink to the gitrepo /data/ folder, so move the .mwm files to organicmaps/data/230121 (might not be 230121, whichever folder’s name is 6 numbers) then re-open the app and they’ll be loaded 😃

ah, i think the latest_coasts file is only generated in a whole-world generation.

Viktor said the one generated from main updates will be uploaded soon (probably to cdn.organicmaps.app), but in the meantime you can add --skip="Coastline". (at least it works for london, i’ve never had to generate a mwm on the coast)

(in the meantime, Geofabrik links work nicely. You only have to login with OSM for the extracts with user metadata, which isn’t used by OM anyway)