1

What I want to do: I have data with point-coordinates (integer) and composite probability (decimal). I want to convert this to raster data to be able to compare it to other layers. The cvs file is available here https://oneecosystem.pensoft.net/article/28143/element/5/4349567/ > Supplementary material 5.

Problem: I get error 4 even though I have not moved the data around, the CRS is correct and I have enough storage space.

What I have tried: Rasterize (vector to raster)

  • With deliminated text layer (CVS) and geopackage.
  • Saving the file again in a new location
  • I have tried pixels and georeferenced units
  • I have tried multiple widths and heights

What am I doing wrong? (pictures for reference of my inputs)

My input Output error

Babel
  • 71,072
  • 14
  • 78
  • 208
kar-g
  • 15
  • 5

1 Answers1

1

There seem to be two problems: layer CRS and file format. To solve both, proceed as follows:

Layer CRS

Your screenshot shows that your data is in a geographic CRS (EPSG:4326). When I download the dataset you provided, however, coordinates are in EPSG:3035. That's why it is important to provide the data you're working with. Always have a background map to check if your data is correctly placed. When importing the data, be sure to set Geometry CRS to EPSG:3035 or - after importing - right click layer > Layer CRS > Set Layer CRS...

Attention: this is not the same as reprojecting! Apart from special cases like this, normally, you should avoid changing the layer's CRS - see https://gis.stackexchange.com/a/392388/88814 and https://gis.stackexchange.com/a/383437/88814.

Loading your data with EPSG:4226 results in projecting them completely outside Earth's extent. The OpenStreetMap map canvas is in the middle of the small circle in the bottom left; the closest of your points is 369 million kilometers away - more than double the distance from the Earth to the sun! Like this, no meaningful calculation is possible:

enter image description here

File format

I then had to export/save the csv as a Geopackage - seems that rasterize does not work based on the csv file.

See the settings I made and the resulting raster layer:

enter image description here

Resulting raster in pseudocolor and NoData values set to transparent: enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
  • thanks, i do still get error 4 even though the terminal shows the file is present. How can I fix this? Last login: Sat Apr 29 15:56:40 on console x@MacBook-Pro-van-x ~ % ls /Users/x/Documents/x DATA Proposal TryPollinationHere.csv Map output Template_LUmap.qpt x@MacBook-Pro-van-x ~ % – kar-g Apr 30 '23 at 11:20
  • Did you reproject? Can you share sample data? – Babel Apr 30 '23 at 11:23
  • Yes: reprojected to EPSG3035, changes width and hight. GDAL command: gdal_rasterize -l None -a CompositeProbability -tr 0.08333333333333 0.08333333333333 -a_nodata 0.0 -ot Float32 -of GTiff "file:///Users/x/Documents/x/TryPollinationHere.csv?type=csv&skipEmptyFields=Yes&maxFields=10000&detectTypes=yes&xField=X&yField=Y&crs=EPSG:3035&spatialIndex=yes&subsetIndex=no&watchFile=no" /Users/x/Documents/Tx/DATA/PollinatorLayer/reprojectdpollinationRASTER.tif GDAL command output: ERROR 4: No such file or directory – kar-g Apr 30 '23 at 11:34
  • What about sample data? – Babel Apr 30 '23 at 11:39
  • Example: X = 4725000 Y = 1435000 Composite probability = 0.418 – kar-g Apr 30 '23 at 11:45
  • That does not help. One single point is of no use. You should provide a csv/shapefile/geopackage with several points to create a raster. – Babel Apr 30 '23 at 11:46
  • i cannot attach the full csv: the cvs file is available here [link] https://oneecosystem.pensoft.net/article/28143/element/5/4349567// sup. material 5. – kar-g Apr 30 '23 at 12:13