Board index FlightGear Development Scenery

osm2city.py development

Questions and discussion about enhancing and populating the FlightGear world.

Re: osm2city.py development

Postby vanosten » Sun Jan 29, 2017 6:07 pm

If you do not mind to install the Postgresql database plus PostGIS, then you might want to give batch processing with database a try: once setup, it is much easier to process vast areas in just one call. See description: http://osm2city.readthedocs.io/en/lates ... batch-mode
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby vanosten » Sun Jan 29, 2017 6:46 pm

powoflight wrote in Mon Jan 23, 2017 8:26 am:Subject : SKIP_LIST = ["Donauturm"] ERROR

In Wien there is a static object called Donauturm and in the osm data there is the same object too. Because the 2 objects are a little far away buildings.py
generates the tower. See picture fgfs-Donauturm.png (is in DONAUTURM.zip included)

So i put in parans.ini SKIP_LIST = ["Donauturm"]

But this gives an error..


Thanks for the detailed report. I have found the bug and pushed an update.

If you do not mind commercial programs, then you might get a happy user of Jetbrain's Pycharm, which has also a free Community version. It has a capable and visual debugger.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby statto » Mon Jan 30, 2017 2:18 am

Would it be possible to use this script to auto-generate airport terminals from around the world and include them as base models on scenemodels?
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2113
Joined: Fri Jan 25, 2008 9:57 pm

Re: osm2city.py development

Postby vanosten » Mon Jan 30, 2017 6:35 pm

There is a possibily related discussion with wlbragg earlier in this thread. Given the general geometry complexity of terminal buildings and the fact that texturing with generic textures would most probably not result in visually appealing models, I doubt that buildings.py in osm2city can be stretched to that. There is also Project3000. But I might not understand what you mean - e.g. "base model" = static model?
Last edited by Johan G on Mon Jan 30, 2017 9:24 pm, edited 1 time in total.
Reason: No need to quote the entire preceding post
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby statto » Tue Jan 31, 2017 2:17 am

Yes, use the script to generate static models.

Another user had posted a python script they used to generate .ac files from shapefiles and the link no longer works. I used it to add a couple terminal buildings to the database with mixed success - I couldn't get the roof textures different from the side textures. KTPA is the best example of this.

Having flown FS2004, I'm of the belief a generically textured, physically accurate terminal structure is better than nothing at most major airports, and I'm looking for a script that will automatically generate .ac from spatial data.
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2113
Joined: Fri Jan 25, 2008 9:57 pm

Re: osm2city.py development

Postby powoflight » Tue Jan 31, 2017 11:54 am

Thanks for the detailed report. I have found the bug and pushed an update.
If you do not mind commercial programs, then you might get a happy user of Jetbrain's Pycharm, which has also a free Community version. It has a capable and visual debugger.

vanosten


Dear Vanosten
I pulled the last git osm2city-master-f5bff2af14f68483fa536dd6f0d10036ee0ed3b1.zip
but now i got an error

Code: Select all
DEBUG:root:stg: OBJECT_SHARED D:\FG\SC\SC_HD\Models\Power\generic_pylon_50m.ac
DEBUG:root:stg: OBJECT_STATIC D:/FG/SC/SC_HD\Objects\e010n40\e016n48\donauturm.xml
DEBUG:root:stg: OBJECT_STATIC D:/FG/SC/SC_HD\Objects\e010n40\e016n48\dct1wn.ac
DEBUG:root:stg: OBJECT_STATIC D:/FG/SC/SC_HD\Objects\e010n40\e016n48\Wiener_Riesenrad.xml
INFO:root:read 212 objects from 1 tiles
DEBUG:root:READ_AC D:\FG\SC\SC_HD\Models\Airport\ndb.ac
DEBUG:root:READ_AC D:\FG\SC\SC_HD\Models\Airport\marker.ac
DEBUG:root:READ_AC D:\FG\SC\SC_HD\Models\Power\generic_pylon_50m.ac
DEBUG:root:READ_AC D:/FG/SC/SC_HD\Objects\e010n40\e016n48\donauturm.ac
DEBUG:root:READ_AC D:/FG/SC/SC_HD\Objects\e010n40\e016n48\dct1wn.ac
DEBUG:root:READ_AC D:/FG/SC/SC_HD\Objects\e010n40\e016n48\Wiener_Riesenrad.ac
INFO:root:Spawning fgelev
INFO:root:cmd line: "D:/FG/FlightGear36/bin/fgelev.exe" --expire 1000000 --fg-scenery D:/FG/SC/SC_HD
Traceback (most recent call last):
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 451, in probe
    elev_is_solid_tuple = self._cache[key]
KeyError: (16.4087658, 48.2408774)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\FG\SC\OSM_Development35\osm2city\buildings.py", line 584, in <module>
    process(my_coords_transform, my_fg_elev, my_blocked_areas)
  File "D:\FG\SC\OSM_Development35\osm2city\buildings.py", line 481, in process
    prepare_textures.facades, prepare_textures.roofs, stats)
  File "D:\FG\SC\OSM_Development35\osm2city\building_lib.py", line 561, in analyse
    elev_is_solid_tuple = fg_elev.probe(Vec2d(Xo[i]))
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 454, in probe
    elev_is_solid_tuple = really_probe(position)
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 407, in really_probe
    self._open_fgelev()
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 360, in _open_fgelev
    bufsize=1, universal_newlines=True, preexec_fn=os.setsid)
AttributeError: module 'os' has no attribute 'setsid
'


I use this params
Code: Select all
PREFIX = "DONAUTURM"   

PATH_TO_SCENERY = "D:/FG/SC/SC_HD"                             
PATH_TO_OUTPUT = "D:/FG/SC/SCENERY_OSM/DONAUTURM"           
PATH_TO_OSM2CITY_DATA = "D:/FG/SC/OSM_Development35/osm2city-data" 
OSM_FILE = "buildings.osm"   

# Optional additional path to a scenery folder (e.g. project3000).
# Only used for overlap checking for buildings against static and shared objects
PATH_TO_SCENERY_OPT = None

#  ok
BOUNDARY_WEST =  16.40709
BOUNDARY_SOUTH = 48.23809
BOUNDARY_EAST =  16.41408
BOUNDARY_NORTH = 48.24130
     
NO_ELEV = False                           # -- skip elevation probing
FG_ELEV = '"D:/FG/FlightGear36/bin/fgelev.exe"'   

TILE_SIZE = 2000            # -- tile size in meters for clustering of buildings

# SKIP_LIST = ["Donau City Tower 1", "Donauturm"]
# SKIP_LIST = ["Donauturm"]
# SKIP_LIST = ["Donau City Tower 1"]


If i got back to the older osm2city osm2city-master-115f66666df90af3e4b8accf3b75cea1ee1ec8d7.zip
from, I think i pulled it down at the 22.01.2017 I works again.

So as you see from the params, i use, i have never tried to skip some Buildings. By the way, in meantime i have delete the 2 objects in the buildings.osm. Maybe i should change the postions of the 2 static objects in
https://scenery.flightgear.org/map/
but do not know how to do it.

Anyway , thank you

Bye
Bernhard
powoflight
 
Posts: 154
Joined: Fri Mar 25, 2016 10:04 am
Location: LOWW
Version: 2020.1
OS: win7 Ubuntu 18.04

Re: osm2city.py development

Postby powoflight » Tue Jan 31, 2017 2:24 pm

I have found something about
AttributeError: module 'os' has no attribute 'setsid'

here
http://stackoverflow.com/questions/3808 ... ute-setsid

Are you on Unix? os.setsid is only available on Unix. – Delioth Jun 28 '16 at 18:02

No I am in Windows – Mo Ameer Jun 28 '16 at 18:34

Then read the docs- os.setsid is not available on Windows,
it is only available on Unix. As a general rule, if you want to do anything with the os module, check the docs since some/lots of functionality is OS dependent (as suggested by the name) here's a link https://docs.python.org/3/library/os.html
powoflight
 
Posts: 154
Joined: Fri Mar 25, 2016 10:04 am
Location: LOWW
Version: 2020.1
OS: win7 Ubuntu 18.04

Re: osm2city.py development

Postby powoflight » Wed Feb 01, 2017 12:41 pm

I have found the problem concerning Win enviroment
For me this is a Dirty hack, but i dont know a other Solution.

I changed in in util/utilities.py
Code: Select all
    def _open_fgelev(self) -> None:
    ..
        # see also https://pymotw.com/2/subprocess/ regarding preexec_fn=os.setsid
        # orig
        #self.fgelev_pipe = subprocess.Popen(fgelev_cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                                            #bufsize=1, universal_newlines=True, preexec_fn=os.setsid)
        # change (Without preexec_fn=os.setsid)
        self.fgelev_pipe = subprocess.Popen(fgelev_cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                                            bufsize=1, universal_newlines=True)


Than i get an other error so disable os.killpg (Because it's not available in WIN too)

Code: Select all
    def close(self) -> None:
    ..
            # os.killpg(self.fgelev_pipe.pid, signal.SIGUSR1)
        self._save_cache()   


Now i get a Warning (This is locical)

INFO:root:FGElev subprocess not yet terminated.
WARNING:root:Needed to kill FGElev subprocess.
But the FGElev prozess will be closed by python/windows.

After this change python building.py is runnung like in the past but if i test again
i get the error

Code: Select all
INFO:root:Reading OSM data from xml took 0.0600 seconds.
INFO:root:SKIPPING Donauturm
INFO:root:Added 0 buildings based on relations.
INFO:root:min/max 16.4070900 48.2380900 16.4140800 48.2413000
INFO:root:Created 45 buildings.
Traceback (most recent call last):
  File "D:\FG\SC\OSM_Development35\osm2city\buildings.py", line 604, in <module>
    process(args.uninstall, args.create_atlas)
  File "D:\FG\SC\OSM_Development35\osm2city\buildings.py", line 428, in process
    tex.screen_osm_tags_for_colour_spelling(b.osm_id, b.tags)
AttributeError: 'bool' object has no attribute 'osm_id'


as i described viewtopic.php?f=5&t=22809&start=645#p303986

However . as a work around, i delete the corresponing items in the building.osm file and it works for me. :)
powoflight
 
Posts: 154
Joined: Fri Mar 25, 2016 10:04 am
Location: LOWW
Version: 2020.1
OS: win7 Ubuntu 18.04

Re: osm2city.py development

Postby vanosten » Tue Feb 07, 2017 5:48 pm

osm2city pylons.py now also places wind turbines according to OSM data - while still trying not to interfer with manually placed shared models. Please tell me incl. screenshot, if the heuristics place the "wrong" shared model.

The following is a picture of the wind turbine farm "Rød Sand 2" near EKMB.

Image
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby vanosten » Tue Feb 07, 2017 5:51 pm

powoflight wrote in Wed Feb 01, 2017 12:41 pm:I have found the problem concerning Win enviroment
For me this is a Dirty hack, but i dont know a other Solution.


I made a change and also tried it on my Windows installation - I hope it works for you.

In general: Sorry, I do most of my testing on Linux only due to limited time. I you use Windows you might hit more anomalies than if you use Linux.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby powoflight » Fri Feb 10, 2017 8:59 am

Concerning
I made a change and also tried it on my Windows installation - I hope it works for you.


I pulled the last git today .
I use as a test the DONAUCITYTOWER (small area).
params.ini
Code: Select all
PREFIX = "DONAUCITYTOWER"   

PATH_TO_SCENERY = "D:/FG/SC/SC_HD"                             
PATH_TO_OUTPUT = "D:/FG/SC/SCENERY_OSM/DONAUCITYTOWER"           
PATH_TO_OSM2CITY_DATA = "D:/FG/SC/OSM_Development35/osm2city-data" 
OSM_FILE = "buildings.osm"   

PATH_TO_SCENERY_OPT = None

BOUNDARY_WEST =  16.40764
BOUNDARY_SOUTH = 48.22902
BOUNDARY_EAST =  16.42170
BOUNDARY_NORTH = 48.23444
     
NO_ELEV = False           # -- skip elevation probing
FG_ELEV = '"D:/FG/FlightGear36/bin/fgelev.exe"'   

TILE_SIZE = 2000         # -- tile size in meters for clustering of buildings

#SKIP_LIST = ["Donau City Tower 1"]

Get an error once again.
Code: Select all
INFO:root:Loading DONAUCITYTOWER\elev.pkl
INFO:root:Loading elev cache failed ([Errno 2] No such file or directory: 'DONAUCITYTOWER\\elev.pkl')
INFO:root:Read 34074 airports, 0 having runways/helipads within the boundary
INFO:root:Execution time: 2.886000
INFO:root:Loading D:/FG/SC/OSM_Development35/osm2city-data\tex\atlas_facades.pkl
INFO:root:Reading OSM data from xml took 0.3276 seconds.
INFO:root:Added 0 buildings based on relations.
INFO:root:min/max 16.4076400 48.2290200 16.4217000 48.2344400
INFO:root:Created 88 buildings.
INFO:root:Generating clusters -522.2625249 -301.3379851 522.2625249 301.3379851
INFO:root:read 212 objects from 1 tiles
INFO:root:Spawning fgelev
Traceback (most recent call last):
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 428, in probe
    elev_is_solid_tuple = self._cache[key]
KeyError: (16.4169579, 48.2307275)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\FG\SC\OSM_Development35\osm2city\buildings.py", line 584, in <module>
    process(my_coords_transform, my_fg_elev, my_blocked_areas)
  File "D:\FG\SC\OSM_Development35\osm2city\buildings.py", line 481, in process
    prepare_textures.facades, prepare_textures.roofs, stats)
  File "D:\FG\SC\OSM_Development35\osm2city\building_lib.py", line 565, in analyse
    elev_is_solid_tuple = fg_elev.probe(Vec2d(Xo[i]))
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 431, in probe
    elev_is_solid_tuple = really_probe(position)
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 384, in really_probe
    self._open_fgelev()
  File "D:\FG\SC\OSM_Development35\osm2city\utils\utilities.py", line 356, in _open_fgelev
    bufsize=1, universal_newlines=True)
  File "C:\Python35\lib\subprocess.py", line 950, in __init__
    restore_signals, start_new_session)
  File "C:\Python35\lib\subprocess.py", line 1220, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden


This error happens if elev.pkl do not exist. Means either it is the first run or i delete elev.pkl
powoflight
 
Posts: 154
Joined: Fri Mar 25, 2016 10:04 am
Location: LOWW
Version: 2020.1
OS: win7 Ubuntu 18.04

Re: osm2city.py development

Postby vanosten » Sat Feb 11, 2017 8:41 am

osm2city pylons.py now replaces buildings tagged as storage tanks with shared models.

Image
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby vanosten » Sat Feb 11, 2017 8:56 am

powoflight wrote in Fri Feb 10, 2017 8:59 am:This error happens if elev.pkl do not exist. Means either it is the first run or i delete elev.pkl


Sorry, I cannot reproduce your error on Linux or Windows. And I need to concentrate on getting the scenery around Bergen ready for 2017.1.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 482
Joined: Sat Sep 25, 2010 5:38 pm
Location: Denmark - but I am Swiss
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby powoflight » Wed Feb 15, 2017 9:11 am

Concerning : viewtopic.php?f=5&t=22809&start=660#p305106

I have found the failure.
It's so trivial, that I ..........

After a lot of investigation in python i have found the problem.
Finally I have delete in params.ini the "Gänsefüßchen" quotation marks for the path of FG_ELEV

# FG_ELEV = '"E:/FG/FlightGear36/bin/fgelev.exe"' # Orig. Do not Work now anylonger
FG_ELEV = 'E:/FG/FlightGear36/bin/fgelev.exe' # This is OK

Now osm2city works.
powoflight
 
Posts: 154
Joined: Fri Mar 25, 2016 10:04 am
Location: LOWW
Version: 2020.1
OS: win7 Ubuntu 18.04

Re: osm2city.py development

Postby pommesschranke » Wed Feb 15, 2017 11:06 am

vanosten wrote in Sat Feb 11, 2017 8:41 am:osm2city pylons.py now replaces buildings tagged as storage tanks with shared models.


that's a very useful feature. thank you!

In older versions of osm2city they were part of the buildings cluster/tile with the advantage of less stg lines and less objects, just the texture was wrong.
Last edited by bugman on Wed Feb 15, 2017 11:15 am, edited 1 time in total.
Reason: Added the missing end quote tag.
pommesschranke
 
Posts: 1105
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 18.04

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 3 guests