TypeError: 'MultiPolygon' object is not iterable when starting batch process
kyuknis opened this issue · comments
I'm new to XP12 and Ortho4XP, so hoping there is just simple something I'm missing. I tried to process the whole state of Florida with zoom level 16 and BI maps (14 tiles) using the tutorial here and I got this error.
GUI Output:
Batch build launched for a number of 24 tiles.
Dealing with tile 1 / 24 : +25-082
CFG error: No config file found for tile +25-082
Step 1 : Building vector data for tile +25-082 :
--------
-> Dealing with airports
* Downloading OSM data for ('node["aeroway"]', 'way["aeroway"]', 'rel["aeroway"]')
KMKY Marco Island Executive Airport 1 runway , lat= 26.00, lon= -81.67
**** Everglades Airpark 1 runway , lat= 25.85, lon= -81.39
**** Lost Horn Ranch Airport 1 runway , lat= 25.97, lon= -81.08
**** Oasis Ranger Station-U.S. Government Airport 1 runway , lat= 25.86, lon= -81.03
**** Romor Ranch Airport 1 runway , lat= 25.99, lon= -81.04
Loading elevation data and smoothing it over airports.
* Min altitude: 0.0 , Max altitude: 9.0 , Mean: 0.2881758
Console output:
2023-07-18 11:24:47.339 Python[24743:3159850] +[CATransaction synchronize] called within transaction
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:268: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
runway_area=VECT.ensure_MultiPolygon(ops.cascaded_union([item[0] for item in runways_as_area+runways_as_line]))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:303: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
hangars=VECT.ensure_MultiPolygon(VECT.improved_buffer(ops.cascaded_union(hangars),2,1,0.5))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:303: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
hangars=VECT.ensure_MultiPolygon(VECT.improved_buffer(ops.cascaded_union(hangars),2,1,0.5))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:303: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
hangars=VECT.ensure_MultiPolygon(VECT.improved_buffer(ops.cascaded_union(hangars),2,1,0.5))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:322: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
aprons=VECT.ensure_MultiPolygon(ops.cascaded_union(aprons))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:322: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
aprons=VECT.ensure_MultiPolygon(ops.cascaded_union(aprons))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:341: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
boundary=ops.cascaded_union([apt['taxiway'][0],apt['apron'][0],apt['hangar'],apt['runway'][0]])
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:343: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
apt['boundary']=VECT.ensure_MultiPolygon(ops.cascaded_union([affinity.translate(apt['boundary'],-tile.lon,-tile.lat),boundary]).buffer(0).simplify(0.00001))
/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py:428: ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
full_area=VECT.ensure_MultiPolygon(ops.cascaded_union([dico_airports[airport]['boundary'],dico_airports[airport]['runway'][0],dico_airports[airport]['hangar'],dico_airports[airport]['taxiway'][0],dico_airports[airport]['apron'][0]]))
Exception in thread Thread-2 (build_tile_list):
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Tile_Utils.py", line 158, in build_tile_list
VMAP.build_poly_file(tile)
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Vector_Map.py", line 42, in build_poly_file
(apt_array,apt_area)=include_airports(vector_map,tile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Vector_Map.py", line 138, in include_airports
APT.smooth_raster_over_airports(tile,dico_airports)
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py", line 429, in smooth_raster_over_airports
for polygon in full_area:
TypeError: 'MultiPolygon' object is not iterable
Ok, so I downgraded shapely from x to 1.7.0 and that error went away, but now I have this guy:
2023-07-18 12:49:06.579 Python[25172:3216340] +[CATransaction synchronize] called within transaction
Exception in thread Thread-2 (build_tile_list):
Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Tile_Utils.py", line 158, in build_tile_list
VMAP.build_poly_file(tile)
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Vector_Map.py", line 42, in build_poly_file
(apt_array,apt_area)=include_airports(vector_map,tile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Vector_Map.py", line 138, in include_airports
APT.smooth_raster_over_airports(tile,dico_airports)
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_Airport_Utils.py", line 436, in smooth_raster_over_airports
tile.dem.alt_dem[rowmin:rowmax+1,colmin:colmax+1]=DEM.smoothen(tile.dem.alt_dem[rowmin:rowmax+1,colmin:colmax+1],pix,airport_im,preserve_boundary=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/kirklandyuknis/Ortho4XP/./src/O4_DEM_Utils.py", line 549, in smoothen
mask_array = numpy.array(mask_im,dtype=numpy.float)/255
^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/numpy/__init__.py", line 313, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?
Ok, finally solved that with a replace numpy.float
and numpy.float32
and numpy.float64
to float
, then finally the same changing numpy.bool
to bool
. If this repo is no longer supported (determined by no authors replying to this) I will fork it and clean it up. UI could be more user friendly as well. If not, I'll push and make a PR for the changes that you can merge so that it's compatible with more up to date libraries.