<div>Thank you; was strange that it did take the .prj information.</div>
<div> </div>
<div>I'd like to setup a wrapper around OGR that asks as few questions as possible.</div>
<div> </div>
<div>=> 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?<br> </div>
<div>-- Stefan<br> </div>
<div><span class="gmail_quote">2008/1/17, Frank Warmerdam <<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Stefan Keller wrote:<br>> I'm trying to a shapefile to KML. The Shapefile driver indicates that<br>
> "If a .prj files (...) is present, it will be read and used to associate<br>> a projection with features.". In addition, the OGR KML driver<br>> documentation says "All OGR KML output will be presented in EPSG:4326.".
<br>><br>> Let's say the input files are myshape.shp, myshape.shx, myshape.dbf and<br>> myshape.prj and I try "ogr2ogr -f kml out.kml myshape.shp".<br>> then the resulting coordinates are still in the source coordinate
<br>> system: Why? I espected that theya re transformed to WGS84 according to<br>> the documentation mentioned.<br>><br>> This is what finally worked: "ogr2ogr -f kml del_prairie.kml<br>> del_prairie.shp -s_srs EPSG:21781 -t_srs EPSG:4326". But indicating
<br>> "-s_srs EPSG:21781" seems to me redundant to the existing file<br>> myshape.prj . Any explanations?<br><br>Stefan,<br><br>ogr2ogr does not reproject coordinates by default, even when writing<br>to formats like KML that only really support one output coordinate system
<br>properly. The -t_srs is the correct way to request reprojection.<br><br>The -s_srs EPSG:21781 option should be unnecessary if the source shapefile<br>already has a readable .prj file.<br><br>Best regards,<br>--<br>---------------------------------------+--------------------------------------
<br>I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a><br>light and sound - activate the windows | <a href="http://pobox.com/~warmerdam">http://pobox.com/~warmerdam
</a><br>and watch the world go round - Rush | President OSGeo, <a href="http://osgeo.org">http://osgeo.org</a><br><br></blockquote></div><br>