configFile = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.ini") Settings.init(configFile) # open output file (if it doesn't already exists) if os.path.exists(options.outFile): sys.exit( "Warning: file '" + options.outFile + "' already exists, remove it or change the destination using the '--output' option.\n" ) with codecs.open(options.outFile, 'w', 'utf-8') as outputFile: # print headers and elevationGrid elevation = None if options.enable3D: elevation = Elevation(Projection.getProjection(), minlat=minlat, minlon=minlon, maxlat=maxlat, maxlon=maxlon, googleAPIKey=options.googleAPIKey) print_header(outputFile, minlat=minlat, minlon=minlon, maxlat=maxlat, maxlon=maxlon, elevation=elevation) print(" * Elevation data acquired") else: print_header(outputFile, minlat=minlat,
# get settings from config file configFile = options.configFile if not configFile: configFile = os.path.join(os.path.dirname(os.path.realpath(__file__)), "config.ini") Settings.init(configFile) # open output file (if it doesn't already exists) if os.path.exists(options.outFile): sys.exit("Warning: file '" + options.outFile + "' already exists, remove it or change the destination using the '--output' option.\n") outputFile = codecs.open(options.outFile, 'w', 'utf-8') # print headers and elevationGrid elevation = None if options.enable3D: elevation = Elevation(Projection.getProjection(), minlat=minlat, minlon=minlon, maxlat=maxlat, maxlon=maxlon, googleAPIKey=options.googleAPIKey) print_header(outputFile, minlat=minlat, minlon=minlon, maxlat=maxlat, maxlon=maxlon, elevation=elevation) print(" * Elevation data acquired") else: print_header(outputFile, minlat=minlat, minlon=minlon, maxlat=maxlat, maxlon=maxlon) WebotsObject.elevation = elevation # parse OSM file parser = Parser() parser.parse_file(options.inFile, options.disableMultipolygonBuildings) Road.initialize_speed_limit(parser.country) print(" * OSM filed parsed") if options.enable3D and elevation is not None: add_height_to_coordinates(elevation) # important to do it before 'center_coordinates'