Hi,
I have finally found some time to test the latest developments (commit Aug 13). For me, it sounds natural to support only the database code: that's the way to go. However, many us have never used a psql database before, and most probably will only use it in this context. In my case it took me some time to figure out some details before I got it working. I would strongly suggest to expand a little bit the section "OSM Data in a PostGIS Database" in the documentation. I mainly faced 2 problems: how to set a valid password for the giuser, and the default listening port which was different in the guide. Here down are some notes that I wrote that my be helpful for a newbie:
Useful command line commands:
Open a database:psql database_name
Delete a database:sudo -u postgres dropdb database_name
Open a database as a database superuser:sudo -u postgres psql database_name
quit database:\q
See the user roles:\du
Problem 1: giuser password not setChange the roles:
https://www.postgresql.org/message-id/4 ... granch.comOpen the database:
sudo -u postgres psql stockholmcheck the roles:
\duchange the password
alter user giuser password 'hola';Problem 2: The listeing port in OSM instructions is wrong:The default port is 5432
Working line:
~/osmosis --read-pbf file="sto.pbf" --log-progress --write-pgsql database=stockholm host=localhost:5432 user=giuser password=hola
Problem 3: /home/vanosten/bin/osmosis-latest/bin/osmosis --read-pbf "/media/sf_fg_customscenery/projects/TEST/kbos.pbf" .....
should be
/home/vanosten/bin/osmosis-latest/bin/osmosis --read-pbf file="/media/sf_fg_customscenery/projects/TEST/kbos.pbf" ....
After these changes, the scripts were working. However, roads.py produced an error due to selfinteresection. My params.ini is:
PREFIX = "STOCKHOLM"
BOUNDARY_WEST = 17.0082
BOUNDARY_SOUTH = 59.0335
BOUNDARY_EAST = 19.1643
BOUNDARY_NORTH = 59.6830
BUILDING_MIN_AREA = 5.0
BUILDING_MIN_HEIGHT = 2.0
PATH_TO_SCENERY = "/home/saul/.fgfs/TerraSync"
PATH_TO_OUTPUT = "/home/saul/flightgear/custom_objects/OUTSVER"
PATH_TO_OSM2CITY_DATA = "/home/saul/flightgear/osm2city/osm2city-data"
# OSM_FILE = "buildings.osm"
USE_DATABASE = True
DB_HOST = "localhost"
DB_PORT = 5432
DB_NAME = "stockholm"
DB_USER = "giuser"
DB_USER_PASSWORD = "hola"
NO_ELEV = False
FG_ELEV = "/home/saul/flightgear/next/install/flightgear/bin/fgelev"
TEXTURES_REGIONS_EXPLICIT = ["de"]
FLAG_2017_2 = True
And the log of roads.py is:
WARNING:root:hstore for osm_id=32148315 has not valid key/value pair: '['construction_date"', '"2009-09-22 ', '"']' in '"building"=>"apartments", "operator"=>"http://www.SKB.org", "architect"=>"Nils Smedmark Arkitekter", "roof:shape"=>"gabled", "start_date"=>"2011", "roof:colour"=>"red", "name_kvarter"=>"kvarteret Glottran", "building:colour"=>"lemonchiffon", "building:levels"=>"5", "construction_date"=>"2009-09-22 =>"'.
INFO:root:Reading OSM way data for ['building'] from db took 11.5300 seconds.
Self-intersection at or near point -27092.710166496017 19324.843601587061
WARNING:shapely.geos:Self-intersection at or near point -27092.710166496017 19324.843601587061
INFO:root:Candidate land-uses with sufficient area added: 12834
INFO:root:Spawning fgelev
Found hole of minimum diameter 0.16384m at lon = 18.0364deg lat = 59.3041deg
INFO:root:Originally lit 3298 - generated lit 41256 - no lit 28502
INFO:root:Added 22789 new streets to existing 50267 highways
INFO:root:There were 28730 existing highways with at least 1 intersection
INFO:root:Originally lit 0 - generated lit 19960 - no lit 10836
INFO:root:Added 8007 new streets to existing 22789 highways
INFO:root:There were 25423 existing highways with at least 1 intersection
Traceback (most recent call last):
File "roads.py", line 1386, in <module>
process(my_coords_transform, my_fg_elev, my_blocked_areas, my_stg_entries)
File "roads.py", line 1337, in process
roads.process(blocked_areas, stg_entries, landuses_lit, stats) # does the heavy lifting incl. clustering
File "roads.py", line 418, in process
self._cleanup_topology()
File "roads.py", line 876, in _cleanup_topology
way.refs.remove(ref)
ValueError: list.remove(x): x not in list
Please let me know if there is something that I am doing wrong.
Many thanks!
Saul