[GRASSLIST:6434] Re: v.out.ogr: Unable to convert to WKT

Paul Kelly paul-grass at stjohnspoint.co.uk
Tue Apr 12 10:51:20 EDT 2005

On Tue, 12 Apr 2005, Jachym Cepicky wrote:

> hallo,
> I try to export raster map with help of r.out.gdal, but it fails:
> GRASS6.1.cvs(cr-jtsk):~> r.out.gdal in=dem_srtm type=Byte
> Writing format: GTiff
> Writing type:   CFloat32
> WARNING: OGR can't parse PROJ.4-style parameter string:
>         +proj=krovak +a=6377397.155 +rf=299.1528128 +no_defs
>         +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56 +to_meter=1.0
>         (OGR Error code was 5)
> WARNING: g.proj: Unable to convert to WKT
> Failed to process SRS definition:
> GRASS6.1.cvs(cr-jtsk):~>
> What to do?

Please try the patch below which should stop r.out.gdal halting when it 
can't write the output projection information. I didn't commit to CVS as I 
wasn't too sure about the quoting.

The real problem is OGR doesn't have a method for converting a PROJ.4 
Krovak projection description into WKT format. Also worth noting that in 
Gerald Evenden's new PROJ version the projection is called proj=kocc, not 
proj=krovak so could get complicated.


Index: r.out.gdal
RCS file: /grassrepository/grass6/scripts/r.out.gdal/r.out.gdal,v
retrieving revision 1.14
diff -u -r1.14 r.out.gdal
--- r.out.gdal	9 Feb 2005 15:14:05 -0000	1.14
+++ r.out.gdal	12 Apr 2005 14:39:41 -0000
@@ -122,8 +122,13 @@
    unset METAKEY

+WKT="`g.proj -wf`"
+if [ ! -z $WKT ] ; then
+  PROJECTION="-a_srs \"${WKT}\""
  #do it
  CELLHD=`echo $file | sed 's+/cell/+/cellhd/+g'`
  echo "Writing format: $FORMAT"
  echo "Writing type:   $TYPE"
-gdal_translate -of $FORMAT -ot $TYPE -a_srs "`g.proj -wf`" $CREATEKEY $METAKEY $CELLHD $OUTPUT 

> Vector files were exported without problem.. (or 'only' with that WARNING about
> that "OGR can't parse PROJ.4-style parameter string")

Yes it is simply the way r.out.gdal doesn't allow for a non-existent WKT 
projection description. Should be fixed in the above patch. Please test.


More information about the grass-user mailing list