Board index FlightGear Development Scenery

osm2city.py development

Questions and discussion about enhancing and populating the FlightGear world.

Re: osm2city.py development

Postby montagdude » Mon Mar 30, 2020 7:29 pm

vanosten wrote in Mon Mar 30, 2020 6:56 pm:I checked. The reason is that one end of the bridge is in the water according to FG scenery. So osm2city needs to assume that it would look odd and therefore does not place a bridge. Once we get a world scenery with cost lines much more aligned with OSM, it will work. Until then: bad luck or place a custom scenery object

Okay, thanks for the information. I am trying to do this with custom scenery that should match the OSM coastlines much more closely. Is there a way I can make it use that instead? Or maybe it already is, but the coastlines still don't match quite well enough? FG_ROOT is pointing to the official fgdata directory, and here are my parameters.

Code: Select all
PREFIX = "block13"
PATH_TO_SCENERY = "/home/dello/Projects/FGScenery_development/MidAtlantic/output"
PATH_TO_OUTPUT = "/home/dello/Projects/FGScenery_development/MidAtlantic/output"
PATH_TO_OSM2CITY_DATA = "/home/dello/Projects/FGScenery_tools/osm2city-data"

NO_ELEV = False
FG_ELEV = "/usr/bin/fgelev"
PROBE_FOR_WATER = True
OWBB_USE_BTG_LANDUSE = False
BUILDING_FORCE_EUROPEAN_INNER_CITY_STYLE = False
POINTS_ON_LINE_DISTANCE_MAX = 100
MAX_SLOPE_ROAD = 0.15

DB_HOST = "localhost"
DB_PORT = 5432
DB_NAME = "block13"
DB_USER = "postgres"
DB_USER_PASSWORD = "***********"

I think it should be working with my custom scenery, based on the PATH_TO_SCENERY variable. If that's not the case, then I would definitely like to know how to make it use my scenery. Also, can I edit the code to make it generate the bridge anyway? Or what if I just turn off PROBE_FOR_WATER?

Edit: here is a map showing my custom landcover data. If it's not matching the OSM data, it's not off by much.
Image
montagdude
 
Posts: 266
Joined: Tue Dec 31, 2019 7:04 am

Re: osm2city.py development

Postby vanosten » Wed Apr 01, 2020 6:12 pm

There is quite an extensive guide, which answers your questions: https://osm2city.readthedocs.io/en/latest/index.html

The map is not precise enough to determine, whether it works. You really have to look at OSM data for the bridge to see, where stuff starts/stops - and then do the overlay with your solid/vs. water geoinfo.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 540
Joined: Sat Sep 25, 2010 6:38 pm
Location: Denmark - but I am Swiss
Pronouns: he/his
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: osm2city.py development

Postby merspieler » Sat Apr 04, 2020 4:31 pm

I've just updated my system (running debian testing) and now I'm getting the following error:
Code: Select all
SpawnPoolWorker-1 root ERROR    ******* Exception in tile 5329442 - to reprocess use boundaries: 145.25_-17.5_145.375_-17.375 *******
Traceback (most recent call last):
  File "/storage/flightgear/scenery/easy-osm2city/osm2city/build_tiles.py", line 130, in process_scenery_tile
    lit_areas, water_areas, osm_buildings = ol.process(the_coords_transform, my_airports)
  File "/storage/flightgear/scenery/easy-osm2city/osm2city/osm2city/owbb/landuse.py", line 875, in process
    btg_reader = _read_btg_file(transformer)
  File "/storage/flightgear/scenery/easy-osm2city/osm2city/osm2city/owbb/landuse.py", line 265, in _read_btg_file
    out_proj = pyproj.Proj('epsg:4326', ellps='WGS84', datum='WGS84')
  File "/storage/flightgear/scenery/easy-osm2city/venv/lib/python3.8/site-packages/pyproj/proj.py", line 126, in __init__
    self.crs = CRS.from_user_input(projparams, **kwargs)
  File "/storage/flightgear/scenery/easy-osm2city/venv/lib/python3.8/site-packages/pyproj/crs/crs.py", line 440, in from_user_input
    return CRS(value, **kwargs)
  File "/storage/flightgear/scenery/easy-osm2city/venv/lib/python3.8/site-packages/pyproj/crs/crs.py", line 296, in __init__
    super().__init__(projstring)
  File "pyproj/_crs.pyx", line 2338, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: epsg:4326 +ellps=WGS84 +datum=WGS84 +type=crs: (Internal Proj Error: proj_create: crs not found)


To me it looks like the crs has been deprecated in a current version.
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2243
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: osm2city.py development

Postby chriscalef » Sat Apr 04, 2020 9:14 pm

I seem to be having a similar problem with CRS, is there any fix for it? (If that is my problem - this is my first time trying to use osm2city so I could have multiple issues.)

This is trying to use osm2city on Windows 10, with a dataset from downtown Portland, Oregon, cropped from the US West PBF file.

Code: Select all
SpawnPoolWorker-1 root ERROR    Exception occurred while processing tile 942561.
Traceback (most recent call last):
  File "D:\FlightGear\osm2city-work\osm2city\build_tiles.py", line 130, in process_scenery_tile
    lit_areas, water_areas, osm_buildings = ol.process(the_coords_transform, my_airports)
  File "D:\FlightGear\osm2city-work\osm2city\osm2city\owbb\landuse.py", line 875, in process
    btg_reader = _read_btg_file(transformer)
  File "D:\FlightGear\osm2city-work\osm2city\osm2city\owbb\landuse.py", line 265, in _read_btg_file
    out_proj = pyproj.Proj('epsg:4326', ellps='WGS84', datum='WGS84')
  File "D:\Python38\lib\site-packages\pyproj\proj.py", line 126, in __init__
    self.crs = CRS.from_user_input(projparams, **kwargs)
  File "D:\Python38\lib\site-packages\pyproj\crs\crs.py", line 440, in from_user_input
    return CRS(value, **kwargs)
  File "D:\Python38\lib\site-packages\pyproj\crs\crs.py", line 296, in __init__
    super().__init__(projstring)
  File "pyproj\_crs.pyx", line 2338, in pyproj._crs._CRS.__init__
pyproj.exceptions.CRSError: Invalid projection: epsg:4326 +ellps=WGS84 +datum=WGS84 +type=crs: (Internal Proj Error: proj_create: crs not found)
SpawnPoolWorker-1 root ERROR    ******* Exception in tile 942561 - to reprocess use boundaries: -122.677_45.515_-122.66_45.53 *******
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

Re: osm2city.py development

Postby merspieler » Sat Apr 04, 2020 10:44 pm

chriscalef: Doesn't seem to be your fault... Can you try to get an older version of pyproj and try again?
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2243
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: osm2city.py development

Postby chriscalef » Sat Apr 04, 2020 11:02 pm

Thanks, I'll try that! I also have access to an Ubuntu OS, if this runs better under linux...?

EDIT: that seems to be working! I moved it back from 2.6.0 to 2.5.0, and avoided the crash, still waiting for it to finish to see what I got, but .... better! Thanks!!
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

Re: osm2city.py development

Postby chriscalef » Sun Apr 05, 2020 1:18 am

Well, shweeet! =-)

Had a little hiccup re: fg_elev, but that was the last real glitch. Now for the infinity of tweaking and experimenting!

Image
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

Re: osm2city.py development

Postby chriscalef » Sun Apr 05, 2020 2:57 am

Very cool! Anybody got any advice for the neatest / cleanest way to intervene with accurate heights for specific buildings? I have LIDAR for this whole area, and am reasonably confident that I can at least pull some manual heights out of that, but I have noticed that OSM is much more reliable for footprint than for height.

Be that as it may, here are two shots of downtown Portand, first one in FG / osm2city, second one in Google Earth. You can recognize the Bancorp building on the right in both shots, and there's just enough other buildings with accurate heights to make things recognizable. Need to figure out what's going on with all those orange highway / bridge textures though.

Image

Image
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

Re: osm2city.py development

Postby radi » Sun Apr 05, 2020 6:22 am

The cleanest way by far is updating the height in OSM.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: osm2city.py development

Postby merspieler » Sun Apr 05, 2020 10:32 am

chriscalef: Thanks for testing. I'll open an issue in the bugtracker.
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2243
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: osm2city.py development

Postby chriscalef » Sun Apr 05, 2020 5:06 pm

@merspieler: My pleasure!! Thanks for your work on this!

@radi: Yeah, modifying OSM was definitely my first choice and that way it would benefit everybody else who uses it too. After forging my way through this process I ended up with a couple of questions though, I guess I should go ask them on the OSM forums but the main one for here was: do I need to use the .pbf format files from OSM to make osm2city work, or is there a way to download just a limited XML output and use that? (Sorry if that's a RTFM question, the manual I read took me to pbf and didn't mention being able to use xml.) The reason I ask is I downloaded a 2 gig file that had all of the western United States in it, and I don't know how to modify that file, and I'm also not sure if that was a live copy of the current data or if it is a file that gets created on the server once a day or something.

I would definitely love to see my work go back into the main OSM data, but I also want a method that gives me instantaneous results locally so I can immediately see what I'm doing.
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

Re: osm2city.py development

Postby merspieler » Sun Apr 05, 2020 5:44 pm

You can use https://extract.bbbike.org/ to get the area you want. I don't know how often they update from mainstream -> how long it takes to get your new data in the extract... for mainline osm it can be up to a week if you don't work with diffs
XML is not recommended due to file size...
Nia (you&, she/her)

Please use gender neutral terms when referring to a group of people!

Be the change you wish to see in the world, be an ally to all!

Join the official matrix space
merspieler
 
Posts: 2243
Joined: Thu Oct 26, 2017 11:43 am
Location: Wish to be in YBCS
Pronouns: you&, she/her
Callsign: you&, she/her
IRC name: merspieler
Version: next
OS: NixOS

Re: osm2city.py development

Postby chriscalef » Sun Apr 05, 2020 6:33 pm

Ah, very cool, thanks for that bbbike link! Perfect.

And yeah I guess it won't kill me to wait a few days for OSM if it avoids the horrors of introducing some other layer of code. :lol:

Side note: Does anybody around here have any favorite pointcloud tools for cropping and measuring? I'm using CloudCompare right now, but I'm not very good at it yet. A few years ago I dug into the PCL (OpenCV-related) project and was able to use it for ground detection plus separating a building layer and a tree layer. I haven't done anything in that zone for a while though, is there a thread here devoted to Lidar consumption?
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

Re: osm2city.py development

Postby montagdude » Sun Apr 05, 2020 7:28 pm

chriscalef wrote in Sun Apr 05, 2020 5:06 pm:@merspieler: My pleasure!! Thanks for your work on this!

@radi: Yeah, modifying OSM was definitely my first choice and that way it would benefit everybody else who uses it too. After forging my way through this process I ended up with a couple of questions though, I guess I should go ask them on the OSM forums but the main one for here was: do I need to use the .pbf format files from OSM to make osm2city work, or is there a way to download just a limited XML output and use that? (Sorry if that's a RTFM question, the manual I read took me to pbf and didn't mention being able to use xml.) The reason I ask is I downloaded a 2 gig file that had all of the western United States in it, and I don't know how to modify that file, and I'm also not sure if that was a live copy of the current data or if it is a file that gets created on the server once a day or something.

I would definitely love to see my work go back into the main OSM data, but I also want a method that gives me instantaneous results locally so I can immediately see what I'm doing.
When you click Extract on the OSM map, it will give you a few options. Some of these will give you a .osm XML file instead of .pbf. To use that with osm2city, you would modify the osmosis extraction step to use the --read-xml CLO instead of --read-pbf.
montagdude
 
Posts: 266
Joined: Tue Dec 31, 2019 7:04 am

Re: osm2city.py development

Postby chriscalef » Sun Apr 05, 2020 7:48 pm

Ah, cool, good to know, thanks montagdude.

One more question: I'm having a hard time figuring out how to tell FG about extra scenery folders. I'm using --terrasync-dir for my main TerraSync files, and trying to use --fg-scenery to tell it to look in my fg_customscenery folder for osm2city output, but so far it ignores that directory. The only way I've made it work so far is to copy the .ac files into my terrains folder and manually modify the stg file by copying and pasting into it from the stg files produced by osm2city. Clearly that is doing it the Wrong Way...? I'm skipping the launcher and running FG from a batch file, so I need a command line or environment variables solution.
chriscalef
 
Posts: 279
Joined: Wed Feb 20, 2013 10:28 pm

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 8 guests