def step_download_and_convert_planet(env: Env, force_download: bool, **kwargs): if force_download or not is_verified(env.paths.planet_osm_pbf): download_planet(env.paths.planet_osm_pbf) convert_planet( env[settings.OSM_TOOL_CONVERT], env.paths.planet_osm_pbf, env.paths.planet_o5m, output=env.get_subprocess_out(), error=env.get_subprocess_out(), ) os.remove(env.paths.planet_osm_pbf) os.remove(md5(env.paths.planet_osm_pbf))
def step_download_and_convert_planet(env: Env, force_download: bool, **kwargs): if force_download or not is_verified(env.paths.planet_osm_pbf): download_files( { settings.PLANET_URL: env.paths.planet_osm_pbf, settings.PLANET_MD5_URL: md5_ext(env.paths.planet_osm_pbf), }, env.force_download_files, ) if not is_verified(env.paths.planet_osm_pbf): raise ValidationError(f"Wrong md5 sum for {env.paths.planet_osm_pbf}.") convert_planet( env[settings.OSM_TOOL_CONVERT], env.paths.planet_osm_pbf, env.paths.planet_o5m, output=env.get_subprocess_out(), error=env.get_subprocess_out(), ) os.remove(env.paths.planet_osm_pbf) os.remove(md5_ext(env.paths.planet_osm_pbf))
def apply(self, env: Env, force_download: bool = True, **kwargs): if force_download or not is_verified(env.paths.planet_o5m): steps.step_download_and_convert_planet( env, force_download=force_download, **kwargs )