I am converting multiple CSV (Lon, Lat, value) to GeoTIFF. My output is in a different projection (EPSG:404000) using

output = 'gdal_grid -a invdist:power=2.0 -zfield "value" -of GTiff -ot Float64 -l %s %s %s' % (lyr_name, vrt_fn, out_tif)

I would like to convert it to EPSG:4326 using each of the following lines alone with no luck. Can I add something to my original output to set the correct projection?

output = 'gdaltransform -s_srs EPSG:404000 -t_srs EPSG:4326 -l %s %s %s' % (lyr_name, vrt_fn, out_tif)

outputSRS = 'epsg:4326'

output = gdal_translate -projwin_srs epsg:4326
  • 1
    That's not valid Python code. And please state the actual result of your attempt. – bugmenot123 Jan 10 '19 at 11:07
  • 404000 isn't a valid EPSG (or Esri CRS). Perhaps define it via its proj string instead? – mkennedy Jan 10 '19 at 18:35
  • undefined epsg. This is a valid python code. I have a code that reads all csvs in a folder and converts them to .vrt and .tif. The line before last is the one i posted. – user2153702 Jan 10 '19 at 21:10
  • I want to add something to the gdal_grid code to specify the epsg:4326. The alternative codes I tried, were post code but none worked. – user2153702 Jan 10 '19 at 21:11
  • EPSG:404000 is a pseudo code when there is no projection – nmtoken Jun 10 '20 at 14:22

The problem is that your input file doesn't have a projection. The simplest fix is to tell gdal_grid what to use as the output projection - -a_srs epsg:4326.

  • like this? output = 'gdal_grid -a invdist:power=2.0 -zfield "value" -of GTiff -ot Float64 -l -a_srs epsg:4326 %s %s %s' % (lyr_name, vrt_fn, out_tif) – user2153702 Jan 10 '19 at 21:00
  • i tried it and it produced .vrt files but no .tif files. – user2153702 Jan 10 '19 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.