Board index FlightGear Development Scenery

osm2city.py development

Questions and discussion about enhancing and populating the FlightGear world.

Re: osm2city.py development

Postby radi » Sun Oct 19, 2014 11:00 pm

osm2city.py discards OSM buildings only
    - if they are smaller than a certain area (see BUILDING_MIN_* and BUILDING_REDUCE_* in parameters file)
    - if there are STATIC_OBJECTs nearby
    - if it can't find suitable textures for them

It knows nothing about land classes so far, so it will not discard buildings just because they're within airport boundaries. I've yet to add this feature :wink:

Are the airport buildings that now went missing STATIC_OBJECTs or do they come from OSM?

Also, since you are running git: please try setting ELEV_MODE = FgelevCaching in your parameters.ini if you have 4GB+ RAM.

new method for elevation probing: ELEV_MODE = FgelevCaching. Osm2city.py (and its siblings) can now start fgelev automatically on demand. Results of elev probing are cached automatically to $PREFIX/elev.pkl, and fgelev is not started before the first cache miss. No more separate elev probing with tools.py/Nasal -- this is likely to become the recommended way now. Better bring some memory, though: fgelev and osm2city together consume quite some RAM. 4GB+ should be fine.
Last edited by radi on Sun Oct 19, 2014 11:16 pm, edited 1 time in total.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby pommesschranke » Sun Oct 19, 2014 11:13 pm

the missing buildings come from OSM - I saw them before, underground when I had the terrain elevation wrong.

new questions:
at a differen area (Sevnica, Slovenia) I have 501 buildings, but they all get skipped because "no elevation"
can I give them a default height, e.g. 4m ?

I also tried roads.py; It created roads but also some very high towers (32000ft high) - some kind of math glitch I guess.
Later I installed the files from LOWI_roads -> most roads look like train tracks now.
pommesschranke
 
Posts: 1104
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 18.04

Re: osm2city.py development

Postby radi » Sun Oct 19, 2014 11:59 pm

can I give them a default height, e.g. 4m ?

If OSM doesn't provide 'building:height' or 'building:levels' tags, you can adjust the default height that osm2city assumes via the BUILDING_CITY_LEVEL* parameters. BUT that doesn't solve your problem: "no elevation" means there is no GROUND elevation. Osm2city would not know and can't guess at which MSL to put the building.

Please try FgelevCaching. That should solve all elevation problems. If you can't run fgelev, make sure your elev probing bounding box (BOUNDARY_* parameters) is big enough to cover all your OSM data. You might have to run the elev probing again. Note that depending on the clipping options used when you obtained the osm file, is may contain data well outside your bounding box.

I also tried roads.py; It created roads but also some very high towers (32000ft high) - some kind of math glitch I guess.

Also related to elev probing, see above.

Later I installed the files from LOWI_roads -> most roads look like train tracks now.

Thanks for the catch. I forgot to published the new roads textures. I've just pushed them to a new repo osm2city-data on git. All textures now reside in osm2city-data. Clone that repo and softlink osm2city-data/tex and osm2city-data/tex.src into osm2city/
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby pommesschranke » Mon Oct 20, 2014 12:55 am

I cloned just now from gitorious and now ELEV_MODE = FgelevCaching does work.
No need to run tools.py anymore ?

can I store the textures at a central place or do I have to save them multiple times in /e010n40/e015n45 , /e010n40/e015n46 ... ?

I had to rename road.eff to roads.eff
Now Streets & train tracks look better that ever before :-)
pommesschranke
 
Posts: 1104
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 18.04

Re: osm2city.py development

Postby radi » Mon Oct 20, 2014 2:19 am

Excellent!

Yes, FgelevCaching does all the work. No need to run tools.py.

I link osm2city-data/tex into my scenery folders as in $FG_SCENERY/Objects/e010n40/e015n45/tex. I guess putting tex/ into $FG_SCENERY/Models/ or even $FGDATA/Models could also work -- haven't tested that though.

I had to rename road.eff to roads.eff

Where/how did you end up with road.eff in the first place? It works here, and the code clearly refers to roads.eff.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby pommesschranke » Mon Oct 20, 2014 11:05 am

Where/how did you end up with road.eff in the first place? It works here, and the code clearly refers to roads.eff.


I found it in the older LOWI_roads folder: fgdata/Effects.

Today I added height and building:levels values to some buildings in OpenSteetMap.

I'm interested to make a similar script for all wind-turbines.
or does such a script exist already ?
viewtopic.php?f=5&t=21691
pommesschranke
 
Posts: 1104
Joined: Sat Apr 27, 2013 7:58 pm
Location: EDLM & LJCE
Callsign: d-laser
IRC name: laserman
Version: git
OS: Linux Lubuntu 18.04

Re: osm2city.py development

Postby radi » Mon Oct 20, 2014 11:44 am

I found it in the older LOWI_roads folder: fgdata/Effects.

Ah, right. Note that there are two road effects, and fgdata/Effects/road*eff is Emilian's traffic shader. Though the correct way of using it would be to set TRAFFIC_SHADER_ENABLE = True and then run roads.py.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby Saga » Tue Oct 21, 2014 5:05 pm

Your work is very awesome!
I've tried your script on ArchLinux. Although I got some issues, the result is pretty cool.

I decided to generated all the buildings near LFRS (radius of ~30km) and the performance was great. :)
The script has lasted only 10 minutes. You could reduce the time by using multi-threading (only one-core of my CPU was used at 100%).

So, I've followed the instructions on the wiki page.

At the install, the environment variable PYTHONPATH seems to not work on my system. So when I executed the script, I had to specify its location. (I didn't tested with the PATH variable but I think it should works)
And you should say we have to copy the contents in osm2city/fgdata to the FlightGear directory install (FG_ROOT), I had errors (textures or effects not found).

Once the parameter files generated, I spotted some errors:
All the variables which contains strings (e.g. PREFIX, PATH_TO_SCENERY, OSM_FILE, ... and even for PATH_TO_OUTPUT) must not contain quotation marks. The script was unable to work. The difference between the original and the modified file.

I had also got errors because the env variable FG_ROOT was not present, you should say on the wiki page to add it. ;)

As you can see in the script output, there is still a problem of directory:
Code: Select all
cp cityLM.eff /mnt/c/fgdata/Scenery/Objects/w010n40/w002n47//cityLM.eff
WARNING:root:Error while installing cityLM.eff: [Errno 2] No such file or directory

So I've copy this file myself. Maybe it's because this file is not in the PYTHONPATH?

But, that's sad to see most of the buildings are underground. In fact all the buildings are at the same elevation. See:
Image

And by the way I was unable to run roads.py because of this PYTHONPATH variable. ^^
Host and maintainer of fgcom.flightgear.org.
Saga
 
Posts: 69
Joined: Tue Mar 04, 2014 2:52 pm
Location: Loire-Atlantique, France
Callsign: F-G0z
Version: Git next
OS: Win7, ArchLinux x64

Re: osm2city.py development

Postby radi » Tue Oct 21, 2014 9:58 pm

1. Thanks for the detailled report, including the params.ini! Excellent!

2. Ignore the PYTHONPATH stuff for now. Currently, it's easier to just cd to osm2city's path and execute it from there:
Code: Select all
  cd path/to/osm2city
  ./osm2city.py -f LOWI/params

3.
All the variables which contains strings (e.g. PREFIX, PATH_TO_SCENERY, OSM_FILE, ... and even for PATH_TO_OUTPUT) must not contain quotation marks.

Thanks for the catch. That's what happens if you check in stuff without testing :oops:

4.
Code: Select all
WARNING:root:Error while installing cityLM.eff: [Errno 2] No such file or directory

See 2. That should solve it.

5. I think your BOUNDARY_EAST / _WEST should be the other way around.

6. Regarding the elevation problem: Since it generates buildings, probing the elevation was OK, but for some reason returned 0. I suspect fgelev can't find the scenery. Try running fgelev directly:
Code: Select all
    /path/to/fgelev --expire 1000 --fg-root $FG_ROOT --fg-scenery $FG_SCENERY

then enter
Code: Select all
   0 -1.45362 47.16837

and see if it returns a sane value. If it does, double-check PATH_TO_SCENERY.

7. Please consider updating the wiki. :wink:
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby abassign » Wed Oct 22, 2014 7:42 am

I saw that you are defining roads and highways, you can also define the rivers? In this way, finally, it will be possible to obtain the banks and a water stream correctly! Obviously, the problem is different, the river is not a curve, but it is an area, but could be worth the effort to try.

I think it is so hard reach this level of X-Plane:

Image
abassign
 
Posts: 831
Joined: Mon Feb 27, 2012 5:09 pm
Location: Italy (living 5 Km from airport LIME)
Callsign: I-BASSY
Version: 2018.3
OS: Linux Mint 19. x

Re: osm2city.py development

Postby radi » Wed Oct 22, 2014 8:35 am

Osm2city would be the wrong place for that, and I won't reinvent the wheel. That certainly belongs in the Terragear/world scenery department, and there's a lot of work being done there. The sole reason I included roads at all was because I needed adjacency data to get the bridges right.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby Thorsten » Wed Oct 22, 2014 8:54 am

I'll be keen to know why this isn't acceptable...

Image
Thorsten
 
Posts: 11441
Joined: Mon Nov 02, 2009 8:33 am

Re: osm2city.py development

Postby Saga » Wed Oct 22, 2014 9:52 am

@radi: Thanks for your help.

I still have an elevation problem. The output of fgelev seems to be wrong. See the console at the right and the position, elevation (in meter and feet) at the left (with the property tree browser):
Image

The value does not correspond to the elevation neither in meter or in feet. But the output of fgelev change according to the latitude and longitude coordinates (but too few ~0.01). And the variable PATH_TO_SCENERY is correct because If I use the command `ls` I get an Object directory. ;)

In the case the bug is really related to fgelev, I suppose you can't do anything and I've to report it on the bug tracker?
Host and maintainer of fgcom.flightgear.org.
Saga
 
Posts: 69
Joined: Tue Mar 04, 2014 2:52 pm
Location: Loire-Atlantique, France
Callsign: F-G0z
Version: Git next
OS: Win7, ArchLinux x64

Re: osm2city.py development

Postby radi » Wed Oct 22, 2014 10:03 am

Umm, what's even more weird: the property browser gives a negative ground elevation of -54.7 m?! I didn't know that the area around Nantes is below MSL.. and fgelev shows 1/100 of that value. Can you try and grab OSM data for another location, say LOWI, and generate buildings there?
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 643
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby Saga » Wed Oct 22, 2014 11:58 am

The ground elevation shown by fgfs is normal, the screenshot has been taken above a stone quarry to highlight the difference between the fgelev output and the map. I'm going to try for LOWI.
EDIT: I won't be able to do it for LOWI because of the issue #1556.
Host and maintainer of fgcom.flightgear.org.
Saga
 
Posts: 69
Joined: Tue Mar 04, 2014 2:52 pm
Location: Loire-Atlantique, France
Callsign: F-G0z
Version: Git next
OS: Win7, ArchLinux x64

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 0 guests