Commit 49ec0761 authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

* New parameter OWBB_HIGHWAY_WIDTH_FACTOR

* Removed PyPy as interpreter possibility
parent 1805ceb5
......@@ -39,8 +39,6 @@ osm2city uses the following Python extension packages, which must be installed o
* scipy
* shapely
* psycopg2-binary
* psycopg2cffi (this and the next one are only needed when using PyPy (see below)
* psycopg2cffi-compat
Please make sure to use Python 3.6+ compatible extensions. Often Python 3 compatible packages have a "3" in their name. Most Linux distributions come by default with the necessary packages — often they are prefixed with ``python-`` (e.g. ``python-numpy``). On Windows WinPython (https://winpython.github.io/) together with Christoph Gohlke's unofficial Windows binaries for Python extension packages (http://www.lfd.uci.edu/~gohlke/pythonlibs/) works well.
......@@ -72,10 +70,7 @@ Then:
numpy==1.14.3
Pillow==5.1.0
pkg-resources==0.0.0
psycopg2==2.7.4
psycopg2-binary==2.7.4
psycopg2cffi==2.7.7
psycopg2cffi-compat==1.1
pycparser==2.18
pyparsing==2.2.0
python-dateutil==2.7.3
......@@ -85,26 +80,7 @@ Then:
six==1.11.0
-----------------------------------------
PyPy as an Alternative Python Interpreter
-----------------------------------------
NB: Experiments in Spring 2018 with Python 3.6 on Linux and PyPy3.6 version 6.0 showed that PyPy does not improve speed, actually it decreases run-time in ``osm2city``.
PyPy_ is a fast, compliant alternative implementation of Python. Thanks to its Just-in-Time compiler, Python programs often run faster on PyPy. You download it from its website. In many cases you need to choose the portable_ version on Linux. Once this is done, create a virtual environment, activate it and install the extensions using ``pip`` like in the previous chapter (for ``scipy`` you might need to install ``gfortran`` into your OS before).
::
user$ /home/vanosten/bin/pypy3.5-6.0.0-linux_x86_64-portable/bin/virtualenv-pypy /home/vanosten/bin/virtualenvs/o2cpypy3560
user$ source /home/vanosten/bin/virtualenvs/o2cpypy3560/bin/activate
(o2cpypy3560) user$ pip install matplotlib
...
.. _Virtualenv: https://virtualenv.pypa.io/en/stable/
.. _PyPy: http://pypy.org/
.. _portable: https://github.com/squeaky-pl/portable-pypy#portable-pypy-distribution-for-linux
.. _chapter-osm2city-install:
......
......@@ -473,6 +473,8 @@ OWBB_RESIDENTIAL_HIGHWAY_MIN_GEN_SHARE Decimal 0.3 If there ar
OWBB_ZONE_AREA_MAX_GEN Decimal 0.1 If the share of floor area of exiting OSM buildings compared to the whole
area is above this value, then no extra buildings are placed.
In the future this value might need to be specific per settlement type.
OWBB_HIGHWAY_WIDTH_FACTOR Decimal 1.3 Factor applied to highway width in order to push buildings exponential more
away from high level highways (highway.width ** factor)
============================================= ======== ======= ==============================================================================
......
......@@ -135,4 +135,55 @@ Depending on your region and your shader settings you might want to search for e
.. image:: fgfs_materials_grass.png
.. _chapter-building_lists:
===========================================================
Change Materials to Use Buildings by Shaders (Experimental)
===========================================================
This is an experimental feature not available in FlightGear version 2018.3.x or earlier. Most people can just ignore this.
Add the following after the last material in ``$FG_ROOT/Materials/default/global.xml``:
...
<material>
<name>OSM_Buildings</name>
<light-coverage>0</light-coverage>
<building-coverage>2500.0</building-coverage>
<building-small-ratio>0.4</building-small-ratio>
<building-medium-ratio>0.5</building-medium-ratio>
<building-large-ratio>0.1</building-large-ratio>
<building-small-pitch>0.8<building-small-pitch>
<building-medium-pitch>0.8</building-medium-pitch>
<building-large-pitch>0.7</building-large-pitch>
<building-small-min-floors>1</building-small-min-floors>
<building-small-max-floors>2</building-small-max-floors>
<building-medium-min-floors>2</building-medium-min-floors>
<building-medium-max-floors>3</building-medium-max-floors>
<building-large-min-floors>3</building-large-min-floors>
<building-large-max-floors>5</building-large-max-floors>
<building-small-min-width-m>9</building-small-min-width-m>
<building-small-max-width-m>14</building-small-max-width-m>
<building-small-min-depth-m>8</building-small-min-depth-m>
<building-small-max-depth-m>12</building-small-max-depth-m>
<building-medium-min-width-m>15</building-medium-min-width-m>
<building-medium-max-width-m>20</building-medium-max-width-m>
<building-medium-min-depth-m>10</building-medium-min-depth-m>
<building-medium-max-depth-m>15</building-medium-max-depth-m>
<building-large-min-width-m>15</building-large-min-width-m>
<building-large-max-width-m>22</building-large-max-width-m>
<building-large-min-depth-m>12</building-large-min-depth-m>
<building-large-max-depth-m>18</building-large-max-depth-m>
</material>
...
.. _ALS: http://wiki.flightgear.org/Atmospheric_light_scattering
......@@ -1088,21 +1088,22 @@ class GenBuilding(object):
def _create_my_polygons(self, highway_width: float) -> None:
"""Creates buffer and area polygons at (0,0) and no angle"""
distance_from_highway = math.pow(highway_width/2, parameters.OWBB_HIGHWAY_WIDTH_FACTOR)
buffer_front = self.shared_model.front_buffer
min_buffer_front = self.shared_model.min_front_buffer
buffer_side = self.shared_model.side_buffer
buffer_back = self.shared_model.back_buffer
self.buffer_polygon = box(-1*(self.shared_model.width/2 + buffer_side),
highway_width/2 + (buffer_front - min_buffer_front),
distance_from_highway + (buffer_front - min_buffer_front),
self.shared_model.width/2 + buffer_side,
highway_width/2 + buffer_front + self.shared_model.depth + buffer_back)
distance_from_highway + buffer_front + self.shared_model.depth + buffer_back)
self.area_polygon = box(-1*(self.shared_model.width/2),
highway_width/2 + buffer_front,
distance_from_highway + buffer_front,
self.shared_model.width/2,
highway_width/2 + buffer_front + self.shared_model.depth)
distance_from_highway + buffer_front + self.shared_model.depth)
self.distance_to_street = highway_width/2 + buffer_front
self.distance_to_street = distance_from_highway + buffer_front
def get_a_polygon(self, has_buffer: bool, highway_point, highway_angle):
"""
......
......@@ -352,6 +352,8 @@ OWBB_ZONE_AREA_MAX_GEN = 0.1 # FIXME: needs to be zone type specific and maybe
OWBB_USE_GENERATED_LANDUSE_FOR_BUILDING_GENERATION = False
OWBB_USE_EXTERNAL_LANDUSE_FOR_BUILDING_GENERATION = True
OWBB_HIGHWAY_WIDTH_FACTOR = 1.3
OWBB_RESIDENTIAL_RURAL_TERRACE_SHARE = 0.1
OWBB_RESIDENTIAL_PERIPHERY_TERRACE_SHARE = 0.25
OWBB_RESIDENTIAL_RURAL_APARTMENT_SHARE = 0.1
......
......@@ -16,12 +16,7 @@ import time
import unittest
import networkx as nx
try:
import psycopg2
except ImportError:
# Fall back to psycopg2cffi in case of using PyPy as interpreter
from psycopg2cffi import compat
compat.register()
import psycopg2
import shapely.geometry as shg
import parameters
......
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