[gdal-dev] ogr2ogr does not project coordinates in csv file

Even Rouault even.rouault at mines-paris.org
Fri Jun 8 07:43:43 PDT 2012


Selon Johann Hirner <johann.hirner at gmx.de>:

> Dear list,
>
> I am trying to transform a list of coordinates in a csv file from EPSG:4326
> to a KML in UTM 32N (EPSG:32632). I am using this command:
> ogr2ogr.exe -f KML -t_srs epsg:32632 out.kml 4326.vrt
>
> However the output coordinates are not transformed (see output below). What
> is it that I am missing?

In fact, there are 2 reprojections occuring :
- the first one done by ogr2ogr from EPSG:4326 to EPSG:32632 as required by the
-t_srs option
- the second one, done implicitely by the KML driver, from EPSG:32632 to
EPSG:4326, since KML requires coordinates to be in EPSG:4326.

KML in UTM 32N is just not possible as per the KML spec.

>
> Kind regards
> Johann
>
> THe vrt file loooks like this:
> <OGRVRTDataSource>
>   <OGRVRTLayer name="4326">
>     <SrcDataSource relativeToVRT="0">4326.csv</SrcDataSource>
>     <GeometryType>wkbPoint</GeometryType>
>     <GeometryField encoding="PointFromColumns" x="lon" y="lat"/>
>     <LayerSRS>EPSG:4326</LayerSRS>
>   </OGRVRTLayer>
> </OGRVRTDataSource>
>
> The csv file looks like this:
> P, lon, lat
> 1, 6.219200, 46.572210
> 2, 9.345943, 46.605497
> 3, 9.330450, 44.000110
> 4, 6.343561, 43.969698
>
> The resulting kml file:
> <?xml version="1.0" encoding="utf-8" ?>
> <kml xmlns="http://www.opengis.net/kml/2.2">
> <Document><Folder><name>4326</name>
> <Schema name="4326" id="4326">
>     <SimpleField name="Name" type="string"></SimpleField>
>     <SimpleField name="Description" type="string"></SimpleField>
>     <SimpleField name="P" type="string"></SimpleField>
>     <SimpleField name="lon" type="string"></SimpleField>
>     <SimpleField name="lat" type="string"></SimpleField>
> </Schema>
>   <Placemark>
>     <ExtendedData><SchemaData schemaUrl="#4326">
>         <SimpleData name="P">1</SimpleData>
>         <SimpleData name="lon">6.219200</SimpleData>
>         <SimpleData name="lat">46.572210</SimpleData>
>     </SchemaData></ExtendedData>
>
> <Point><coordinates>6.219199999982147,46.572209999958666</coordinates></Point>
>   </Placemark>
>   <Placemark>
>     <ExtendedData><SchemaData schemaUrl="#4326">
>         <SimpleData name="P">2</SimpleData>
>         <SimpleData name="lon">9.345943</SimpleData>
>         <SimpleData name="lat">46.605497</SimpleData>
>     </SchemaData></ExtendedData>
>       <Point><coordinates>9.345943,46.605497</coordinates></Point>
>   </Placemark>
>   <Placemark>
>     <ExtendedData><SchemaData schemaUrl="#4326">
>         <SimpleData name="P">3</SimpleData>
>         <SimpleData name="lon">9.330450</SimpleData>
>         <SimpleData name="lat">44.000110</SimpleData>
>     </SchemaData></ExtendedData>
>       <Point><coordinates>9.33045,44.00011</coordinates></Point>
>   </Placemark>
>   <Placemark>
>     <ExtendedData><SchemaData schemaUrl="#4326">
>         <SimpleData name="P">4</SimpleData>
>         <SimpleData name="lon">6.343561</SimpleData>
>         <SimpleData name="lat">43.969698</SimpleData>
>     </SchemaData></ExtendedData>
>
> <Point><coordinates>6.343560999981887,43.96969799997111</coordinates></Point>
>   </Placemark>
> </Folder></Document></kml>
> --
> NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
> Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
> _______________________________________________
> 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