Re-enabled function to bulk-generate OSM data without rendering tiles (to offer the data packs)

This commit is contained in:
Marcus Str. 2025-02-02 12:23:53 +01:00
parent bef92f82fa
commit 8f08b3dfb3
3 changed files with 18 additions and 2 deletions

7
og.py
View File

@ -62,15 +62,22 @@ if __name__ == '__main__':
# Create the class and init values
og = mstr_orthographic(lat, lng, mstr_datafolder, os.getcwd(), prep)
# Simply generate OSM data
if sys.argv[3] == "osm":
og._generateData()
exit()
# Generate orthos
if sys.argv[3] != "prepare" and sys.argv[3] != "xpscenery":
_welcome()
og._generateOrthos_mt(int(sys.argv[3]))
exit()
# Build the terrain mesh and assign ground textures
if sys.argv[3] == "xpscenery":
_welcome()
og.generate_xp_scenery()
exit()
if cli == False and pbf == False:

View File

@ -96,7 +96,8 @@ class mstr_orthographic:
bb_lng_edge = self._long+self._zoomlevel
cur_tile_x = 1
cur_tile_y = 1
osmxml = mstr_osmxml(0,0)
osmxml = mstr_osmxml()
osmxml.setLatLngFld(self._latlngfld)
mstr_msg("orthographic", "Set initial coordinates and bounding box for OSM acquisition")
# The highest encountered tile numbers
@ -110,9 +111,15 @@ class mstr_orthographic:
mlng = 1
while bb_lat < self._lat + 1:
bb_lat = bb_lat + self._vstep
if bb_lat >= self._lat + 1:
bb_lat = bb_lat - self._zoomlevel
break
mlat = mlat+1
while bb_lng < self._long + 1:
bb_lng = bb_lng + self._zoomlevel
if bb_lng >= self._long + 1:
bb_lng = bb_lng - self._zoomlevel
break
mlng = mlng+1
mstr_msg("orthographic", "Max lat tile: " + str(mlat) + " - max lng tile: " + str(mlng))
maxlatlng = [ mlat, mlng ]
@ -128,7 +135,6 @@ class mstr_orthographic:
for lng_grid in range(1, maxlatlng[1]+1):
# Adjust bounding box
osmxml.adjust_bbox(bb_lat, bb_lng, bb_lat_edge, bb_lng_edge)
osmxml.generate_osm(cur_tile_y, cur_tile_x) # <- This acquires current OSM info
# Adjust longitude coordinates

View File

@ -64,6 +64,9 @@ class mstr_osmxml:
"as_pbf": "true"
}
r = requests.post(mstr_osm_endpoint, json=data)
#fn = mstr_datafolder + "z_orthographic/data/" + self._latlngfld + "/osm/" + str(int(self._lat)) + "-" + str(v) + "_" + str(int(self._lng)) + "-" + str(h) + ".xml"
#with open(fn, 'wb') as textfile:
# textfile.write(r.content)
# Acquire XMLs in chunks, then store them