Commit 44546bae authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Small wording updates in documentation. Changing log levels to more conservative logging

parent bd957f8b
......@@ -125,7 +125,7 @@ def _get_nodes_from_acs(objs, own_prefix):
logging.verbose("CACHED_AC %s" % fname)
ac = read_objects[fname]
else:
logging.info("READ_AC %s" % fname)
logging.debug("READ_AC %s" % fname)
ac = ac3d_fast.File(file_name=fname, stats=None)
read_objects[fname] = ac
......
......@@ -85,7 +85,7 @@ As described in chapter :ref:`Getting OpenStreetMap data <chapter-getting-data-l
The default work flow is based on the sub-chapters of :ref:`Preparation <chapter-preparation-label>`:
#. :ref:`Run setup.py <chapter-run-setup-label>` depending on your chosen `Elevation Probing Mode <chapter-elev-modes-label>`.
#. :ref:`Run setup.py <chapter-run-setup-label>` depending on your chosen :ref:`Elevation Probing Mode <chapter-elev-modes-label>`.
#. Adapt ``params.ini``. This will get copied to several subdirectories as part of the next process steps. Most importantly apapt the parameter ``PATH_TO_OUTPUT`` (in the example below "/home/fg_customscenery/CH_OSM"). The ``PREFIX`` and ``BOUNDARY_*`` parameters will automatically be updated.
#. :ref:`Call build_tiles.py <chapter-build-tiles-label>`. This step creates sub-directories including a set of shell / command scripts. The top directory will be created in your ``WORKING_DIRECTORY`` and have the same name as the lon/lat area specified with argument ``-t``
#. If needed adapt the params.ini files in the sub-directories if you need to change specific characteristics within one tile (e.g. parameters for building height etc.). In most situations this will not be needed.
......@@ -113,11 +113,11 @@ Mandatory command line arguments:
Optional command line arguments:
* -p: You can use this option on Linux and Mac in order to generate scripts with parallel processing support and specify the max number of parallel processes when calling the generated scripts.
* -u: Which API to use to download OSM data on the fly.
* -u: The URL of the API to use to download OSM data on the fly (e.g. http://www.overpass-api.de/api/xapi_meta?). Only useful if argument ``-d`` is not used.
* -n: There are two implementations of downloading data on the fly. If this option is used, then a download program is used, which has better support for retries (FIXME: does this work?)
* -x: If ``python`` is not in your executable path or you want to specify a specific Python version if you have installed several versions, then use this argument (e.g. ``/usr/bin/python3.5``).
* -d: Instead of dynamic download an existing OSM data file as specified in the overall ``params.ini`` will be used. This can be used if e.g. ``curl`` is not available (mostly on Windows) or if you have problems with dynamic download or if you need to manipulate the OSM data after download and before processing. A pre-requisite for this is that you have Osmosis installed on your computer (see also :ref:`Getting OpenStreetMap Data <chapter-getting-data-label>`) — the path to the Osmosis executable needs to be specified with this command line argument.
* -o: the name of the copied params.ini files in the sub-directories
* -o: the name of the copied params.ini files in the sub-directories. There is rarely a reason to deviate from the standard and therefore using this parameter.
Calling build_tiles.py with optional argument ``-d`` could look like the following:
......
......@@ -52,6 +52,14 @@ Do the following:
#. Add the ``osm2city`` directory to your ``PYTHONPATH``. You can read more about this at https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH.
#. Create soft links between as described in the following sub-chapter.
On Linux you would typically add something like the following to your ``.bashrc`` file:
::
PYTHONPATH=$HOME/develop_vcs/python3/osm2city
export PYTHONPATH
.. _Git: http://www.git-scm.com/
......
......@@ -113,21 +113,18 @@ LOD_PERCENTAGE_DETAIL Decimal 0.5 Of the rema
.. _chapter-parameters-clipping:
----------------
---------------
Clipping Region
----------------
---------------
The boundary of a scenery as specified by the parameters ``BOUNDARY_*`` is not necessarily sharp. As described in :ref:`Getting OpenStreetMap Data <chapter-getting-data-label>` it is recommended to use ``completeWays=yes``, when manipulating/getting OSM data - this happens also to be the case when using the `OSM Extended API`_ to retrieve data e.g. as part of :ref:`Working in batch mode <chapter-batch-mode>`. The parameters below give the possibility to influence, which data outside of the boundary is processed.
.. _`OSM Extended API`: http://wiki.openstreetmap.org/wiki/Xapi
BOUNDARY_CLIPPING = True
BOUNDARY_CLIPPING_BORDER_SIZE = 0.25
============================================= ======== ======= ==============================================================================
Parameter Type Default Description / Example
============================================= ======== ======= ==============================================================================
BOUNDARY_CLIPPING Boolean True If True the everythin outside the boundary is clipped away. This clipping
BOUNDARY_CLIPPING Boolean True If True the everything outside the boundary is clipped away. This clipping
includes ways (e.g. roads, buildings), where nodes outside the boundary
are removed.
If both this parameter and ``BOUNDARY_CLIPPING_COMPLETE_WAYS`` are set to
......@@ -138,7 +135,7 @@ BOUNDARY_CLIPPING_BORDER_SIZE Decimal 0.25 Additional
BOUNDARY_CLIPPING_COMPLETE_WAYS Boolean False If True it overrides ``BOUNDARY_CLIPPING`` and keeps all those ways, where the
first referenced node is within the boundary as specified by ``BOUNDARY_*``.
This leads to more a graceful handling when different adjacent sceneries are
This leads to a more graceful handling when different adjacent sceneries are
created (e.g. batch processing), such that e.g. roads not just stop on either
side of the boundary. However this comes with the cost of more needed
processing. Do not use if just one scenery area in one pass is created.
......
This diff is collapsed.
......@@ -318,14 +318,14 @@ def show():
def read_from_file(filename):
logging.info('Reading parameters from file: %s' % filename)
default_globals = globals()
file_globals = {'textures': default_globals['textures']}
file_globals = dict() # {'textures': default_globals['textures']}
try:
exec(compile(open(filename).read(), filename, 'exec'), file_globals)
except IOError as reason:
logging.error("Error processing file with parameters: %s", reason)
sys.exit(1)
except NameError:
print(traceback.format_exc())
logging.error(traceback.format_exc())
logging.error("Error while reading " + filename + ". Perhaps an unquoted string in your parameters file?")
sys.exit(1)
......
......@@ -20,7 +20,6 @@ import osm2city
import tools
from vec2d import vec2d
import calc_tile
from pdb import pm
import time
......@@ -39,7 +38,7 @@ class STG_File(object):
self.our_ac_file_name_list = []
self.magic = magic
self.prefix = prefix
#deprecated usage
# deprecated usage
self.our_magic_start = delimiter_string(self.magic, None, True)
self.our_magic_end = delimiter_string(self.magic, None, False)
self.our_magic_start_new = delimiter_string(self.magic, prefix, True)
......@@ -53,12 +52,11 @@ class STG_File(object):
lines = stg.readlines()
stg.close()
except IOError as reason:
logging.warning("error reading %s: %s", self.file_name, reason)
logging.info("Error reading %s as it might not exist yet: %s", self.file_name, reason)
return
temp_other_list = []
#deal with broken files containing several sections (old version)
# deal with broken files containing several sections (old version)
while lines.count(self.our_magic_start) > 0:
try:
ours_start = lines.index(self.our_magic_start)
......@@ -72,12 +70,11 @@ class STG_File(object):
ours_end = len(lines)
temp_other_list = temp_other_list + lines[:ours_start]
# self.our_list = lines[ours_start+1:ours_end]
lines = lines[ours_end+1:]
temp_other_list = temp_other_list + lines
self.other_list = []
#deal with broken files containing several sections (new version)
# deal with broken files containing several sections (new version)
while temp_other_list.count(self.our_magic_start_new) > 0:
try:
ours_start = temp_other_list.index(self.our_magic_start_new)
......@@ -91,11 +88,9 @@ class STG_File(object):
ours_end = len(temp_other_list)
self.other_list = self.other_list + lines[:ours_start]
# self.our_list = lines[ours_start+1:ours_end]
temp_other_list = temp_other_list[ours_end+1:]
self.other_list = self.other_list + temp_other_list
def drop_ours(self):
"""Clear our list. Call write() afterwards to finish uninstall"""
self.our_list = []
......@@ -130,21 +125,21 @@ class STG_File(object):
def write(self):
"""write others and ours to file"""
#read directly before write to
# read directly before write to
self.read()
self.make_path_to_stg()
stg = open(self.file_name, 'w')
logging.info("Writing %d other lines"%len(self.other_list))
logging.info("Writing %d other lines" % len(self.other_list))
for line in self.other_list:
stg.write(line)
if self.our_list:
logging.info("Writing %d lines"%len(self.our_list))
logging.info("Writing %d lines" % len(self.our_list))
stg.write(self.our_magic_start_new)
stg.write("# do not edit below this line\n")
stg.write("# Last Written %s\n#\n"%time.strftime("%c"))
for line in self.our_list:
logging.info(line.strip())
logging.debug(line.strip())
stg.write(line)
stg.write(self.our_magic_end_new)
......@@ -156,7 +151,7 @@ class STG_Manager(object):
prefix separates different writers to work around two PREFIX areas interleaving
"""
def __init__(self, path_to_scenery, magic, prefix=None, overwrite=False):
self.stg_dict = {} # maps tile index to stg object
self.stg_dict = dict() # maps tile index to stg object
self.path_to_scenery = path_to_scenery
self.overwrite = overwrite
self.magic = magic
......@@ -170,7 +165,7 @@ class STG_Manager(object):
except KeyError:
the_stg = STG_File(lon_lat, tile_index, self.path_to_scenery, self.magic, self.prefix)
self.stg_dict[tile_index] = the_stg
if overwrite == None:
if overwrite is None:
overwrite = self.overwrite
if overwrite:
# this will only drop the section we previously wrote ()
......@@ -229,8 +224,6 @@ def read_stg_entries(stg_path_and_name, our_magic, ignore_bad_lines=False):
TODO: In the future, take care of multiple scenery paths here.
TODO: should be able to take a list of our_magic"""
entries = [] # list of STGEntry objects
logger = logging.getLogger("stgio2")
if None is not our_magic:
our_magic_start = delimiter_string(our_magic, None, True)
......@@ -262,23 +255,23 @@ def read_stg_entries(stg_path_and_name, our_magic, ignore_bad_lines=False):
hdg = float(splitted[5])
entry = STGEntry(type_, obj_filename, path, lon, lat, elev, hdg)
entries.append(entry)
logger.debug("stg: %s %s", type_, entry.get_obj_path_and_name())
logging.debug("stg: %s %s", type_, entry.get_obj_path_and_name())
except ValueError as reason:
if not ignore_bad_lines:
logger.warning("stg_io:read: Damaged file %s", reason)
logger.warning("Damaged line: %s", line.strip())
logging.warning("stg_io:read: Damaged file %s", reason)
logging.warning("Damaged line: %s", line.strip())
return []
else:
logger.warning("Damaged line: %s", line.strip())
logging.warning("Damaged line: %s", line.strip())
except IndexError as reason:
if not ignore_bad_lines:
logger.warning("stg_io:read: Ignoring unreadable file %s", reason)
logger.warning("Offending line: %s", line.strip())
logging.warning("stg_io:read: Ignoring unreadable file %s", reason)
logging.warning("Offending line: %s", line.strip())
return []
else:
logger.warning("Damaged line: %s", line.strip())
logging.warning("Damaged line: %s", line.strip())
except IOError as reason:
logger.warning("stg_io:read: Ignoring unreadable file %s", reason)
logging.warning("stg_io:read: Ignoring unreadable file %s", reason)
return []
return entries
......@@ -289,10 +282,10 @@ def read(path, stg_fname, our_magic):
building_objs = []
for entry in stg_entries:
point = shg.Point(tools.transform.toLocal((entry.lon, entry.lat)))
building_objs.append(osm2city.Building(osm_id=-1, tags=-1, outer_ring=point
, name=entry.get_obj_path_and_name()
, height=0, levels=0, stg_typ=entry.get_object_type_as_string()
, stg_hdg=entry.hdg))
building_objs.append(osm2city.Building(osm_id=-1, tags=-1, outer_ring=point,
name=entry.get_obj_path_and_name(),
height=0, levels=0, stg_typ=entry.get_object_type_as_string(),
stg_hdg=entry.hdg))
return building_objs
......
......@@ -219,11 +219,8 @@ class Probe_fgelev(object):
self._cache = pickle.load(fpickle)
fpickle.close()
logging.info("OK")
except IOError as reason:
logging.warning("Loading elev cache failed (%s)", reason)
self._cache = {}
except EOFError as reason:
logging.warning("Loading elev cache failed (%s)", reason)
except (IOError, EOFError) as reason:
logging.info("Loading elev cache failed (%s)", reason)
self._cache = {}
else:
self._cache = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment