diff --git a/og.py b/og.py index 3ff99af..cddab7f 100644 --- a/og.py +++ b/og.py @@ -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: diff --git a/orthographic.py b/orthographic.py index 33736c4..355cba4 100644 --- a/orthographic.py +++ b/orthographic.py @@ -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 diff --git a/osmxml.py b/osmxml.py index c5359f4..3826b0a 100644 --- a/osmxml.py +++ b/osmxml.py @@ -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