[gdal-dev] gdal_rasterize 1.8.0 options

Even Rouault even.rouault at mines-paris.org
Sat Feb 19 19:25:23 EST 2011


Le dimanche 20 février 2011 00:46:07, Marius Jigmond a écrit :
> Should it then match http://spatialreference.org/ref/epsg/3844/esriwkt/
> because it does not seem to? I apologize if my questions seem silly.

With all respect due to the great job of that site, I'm not sure you can 
blindly trust spatialreference.org to be always a genuine reference (I'm not 
sure that in the world of SRS, there is *a* reference ...). The data in there 
comes from the output of various software packages, including GDAL or 
GeoTools, that might not be the most recent ones and have some bugs. This WKT 
with the space in "Oblique_Stereographic" is likely coming from GeoTools.  See 
http://www.osgeo.org/pipermail/metacrs/2008-December/000187.html that gives 
some hint on where data of spatialreference.org comes from.

Anyway, with latest GDAL trunk, if I do a ogr2ogr -a_srs EPSG:3844 
foo_3844.shp foo.shp,

foo_3844.prj is :

PROJCS["Pulkovo_1942_58_Stereo70",GEOGCS["GCS_Pulkovo 
1942(58)",DATUM["D_Pulkovo_1942_Adj_1958",SPHEROID["Krassowsky_1940",6378245,298.3]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Stereographic"],PARAMETER["latitude_of_origin",46],PARAMETER["central_meridian",25],PARAMETER["scale_factor",0.99975],PARAMETER["false_easting",500000],PARAMETER["false_northing",500000],UNIT["Meter",1]]

And ogrinfo reads it back as :

PROJCS["Pulkovo_1942_58_Stereo70",
    GEOGCS["GCS_Pulkovo 1942(58)",
        DATUM["Pulkovo_1942_58",
            SPHEROID["Krassowsky_1940",6378245,298.3]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]],
    PROJECTION["Oblique_Stereographic"],
    PARAMETER["latitude_of_origin",46],
    PARAMETER["central_meridian",25],
    PARAMETER["scale_factor",0.99975],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",500000],
    UNIT["Meter",1]]

which is nearly identical to the output of gdalinfo (except that the 
ESRI'fication loses the AUTHORITY nodes)

> 
> -marius
> 
> On Sun, 2011-02-20 at 00:38 +0100, Even Rouault wrote:
> > Le dimanche 20 février 2011 00:24:16, Marius Jigmond a écrit :
> > > Is the disconnect simply a reporting issue and reprojections are
> > > handled properly behind the scenes when using this EPSG code? It seems
> > > that what gdalinfo reports is in accordance to
> > > http://spatialreference.org/ref/epsg/3844/html/ .
> > 
> > Marius,
> > 
> > The .prj file of shapefiles stores WKT in ESRI WKT, not OGC WKT.
> > http://trac.osgeo.org/gdal/changeset/21627 (which is a fix not found in
> > 1.8.0) translates the ESRI "Stereographic" into the OGC
> > "Oblique_Stereographic", to be consistant with what is done in the
> > reverse transformation
> > 
> > > -marius
> > > 
> > > On Sat, 2011-02-05 at 00:06 +0100, Even Rouault wrote:
> > > > Le vendredi 04 février 2011 20:25:43, Marius Jigmond a écrit :
> > > > > Hi Everyone,
> > > > > 
> > > > > Some of the options (I didn't test all) introduced with version
> > > > > 1.8.0 seem to behave strangely. Here's what I'm doing:
> > > > > 1. gdal_rasterize -burn 0 -i -l mask mask.shp sample.tif
> > > > > works fine but I get the following warning:
> > > > > Warning : the output raster dataset and the input vector layer do
> > > > > not have the same SRS.
> > > > > Results might be incorrect (no on-the-fly reprojection of input
> > > > > data). even though both inputs use the same projection, EPSG:3844.
> > > > 
> > > > Unrelated with GDAL 1.8.0. The issue was that the transformation
> > > > between OGC WKT and ESRI WKT didn't handle well the Oblique
> > > > Stereographic projection. Fixed in trunk in
> > > > http://trac.osgeo.org/gdal/changeset/21627
> > > > 
> > > > > 2. gdal_rasterize -burn 0 -i -a_srs EPSG:3844 -l mask mask.shp
> > > > > sample.tif
> > > > > fails with: '-tr xres yes' or '-ts xsize ysize' is required.
> > > > > 
> > > > > 3. gdal_rasterize -burn 0 -i -a_nodata 0 -l mask mask.shp
> > > > > sample.tif fails with: '-tr xres yes' or '-ts xsize ysize' is
> > > > > required.
> > > > > 
> > > > > >From http://www.gdal.org/gdal_rasterize.html it doesn't seem that
> > > > > >-a_srs
> > > > > 
> > > > > or -a_nodata would require -tr or -ts. Am I doing something wrong?
> > > > 
> > > > When those 2 new options are used, they imply creating a new dataset.
> > > > So they actually need to be used with -tr or -ts option.
> > > > 
> > > > > -marius
> > > > > 
> > > > > _______________________________________________
> > > > > gdal-dev mailing list
> > > > > gdal-dev at lists.osgeo.org
> > > > > http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list