OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

I have a problem when using gdal's vsimem feature

  • Thread starter Thread starter HEXtoBIN
  • Start date Start date
H

HEXtoBIN

Guest
code like this:

Code:
calculate_boundary_weights(polys_in_area, scale=config.boundary_scale).to_file("/vsimem/weights.vrt")
gdal.Rasterize(mem_ds, "/vsimem/weights.vrt", bands=[n_bands+2], burnValues=[1], allTouched=True)

here is the problem:

Code:
Traceback (most recent call last):
  File "/home/songzirui/桌面/planetunet-nonorm/main.py", line 17, in <module>
    preprocessing.preprocess_all(config)
  File "/home/songzirui/桌面/planetunet-nonorm/preprocessing.py", line 233, in preprocess_all
    gdal.Rasterize(mem_ds, "/vsimem/weights.vrt", bands=[n_bands+2], burnValues=[1], allTouched=True)
  File "/home/songzirui/anaconda3/envs/tfgdal/lib/python3.8/site-packages/osgeo/gdal.py", line 1526, in Rasterize
    srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR)
  File "/home/songzirui/anaconda3/envs/tfgdal/lib/python3.8/site-packages/osgeo/gdal.py", line 4720, in OpenEx
    return _gdal.OpenEx(*args, **kwargs)
RuntimeError: No such file or directory

I can't figure out the exact usage of gdal's vsimem, but i can print the content of "calculate_boundary_weights(polys_in_area, scale=config.boundary_scale)", i wonder why i can't write the content in /vsimem/weights.
<p>code like this:</p>
<pre><code>calculate_boundary_weights(polys_in_area, scale=config.boundary_scale).to_file("/vsimem/weights.vrt")
gdal.Rasterize(mem_ds, "/vsimem/weights.vrt", bands=[n_bands+2], burnValues=[1], allTouched=True)
</code></pre>
<p>here is the problem:</p>
<pre><code>Traceback (most recent call last):
File "/home/songzirui/桌面/planetunet-nonorm/main.py", line 17, in <module>
preprocessing.preprocess_all(config)
File "/home/songzirui/桌面/planetunet-nonorm/preprocessing.py", line 233, in preprocess_all
gdal.Rasterize(mem_ds, "/vsimem/weights.vrt", bands=[n_bands+2], burnValues=[1], allTouched=True)
File "/home/songzirui/anaconda3/envs/tfgdal/lib/python3.8/site-packages/osgeo/gdal.py", line 1526, in Rasterize
srcDS = OpenEx(srcDS, gdalconst.OF_VECTOR)
File "/home/songzirui/anaconda3/envs/tfgdal/lib/python3.8/site-packages/osgeo/gdal.py", line 4720, in OpenEx
return _gdal.OpenEx(*args, **kwargs)
RuntimeError: No such file or directory
</code></pre>
<p>I can't figure out the exact usage of gdal's vsimem, but i can print the content of "calculate_boundary_weights(polys_in_area, scale=config.boundary_scale)", i wonder why i can't write the content in /vsimem/weights.</p>
 

Online statistics

Members online
0
Guests online
5
Total visitors
5
Top