[gdal-dev] myshape.prj versus -s_srs

Stefan Keller sfkeller at gmail.com
Fri Jan 18 01:20:35 EST 2008


Thank you; was strange that it did take the .prj information.

I'd like to setup a wrapper around OGR that asks as few questions as
possible.

=> Is there a reliable way to find out if ogr2ogr recognizes an SRS from the
source format without -s_srs parameter? ogrinfo with return code?

-- Stefan

2008/1/17, Frank Warmerdam <warmerdam at pobox.com>:
>
> Stefan Keller wrote:
> > I'm trying to a shapefile to KML. The Shapefile driver indicates that
> > "If a .prj files (...) is present, it will be read and used to associate
> > a projection with features.". In addition, the OGR KML driver
> > documentation says "All OGR KML output will be presented in EPSG:4326.".
> >
> > Let's say the input files are myshape.shp, myshape.shx, myshape.dbf and
> > myshape.prj and I try "ogr2ogr -f kml out.kml myshape.shp".
> > then the resulting coordinates are still in the source coordinate
> > system: Why? I espected that theya re transformed to WGS84 according to
> > the documentation mentioned.
> >
> > This is what finally worked: "ogr2ogr -f kml del_prairie.kml
> > del_prairie.shp -s_srs EPSG:21781 -t_srs EPSG:4326". But indicating
> > "-s_srs EPSG:21781" seems to me redundant to the existing file
> > myshape.prj . Any explanations?
>
> Stefan,
>
> ogr2ogr does not reproject coordinates by default, even when writing
> to formats like KML that only really support one output coordinate system
> properly.  The -t_srs is the correct way to request reprojection.
>
> The -s_srs EPSG:21781 option should be unnecessary if the source shapefile
> already has a readable .prj file.
>
> Best regards,
> --
>
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | President OSGeo, http://osgeo.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080118/2f03da42/attachment.html


More information about the gdal-dev mailing list