[FWTools] (no subject)

Newman, Michael (Windsor,CT-US) MNewman at trcsolutions.com
Mon Jul 20 11:54:24 EST 2009

Given a test case of two files:

File: "input.csv"
48.1,-72.25,"First point"
49.2,-72.1,"Second point"
47.5,-72.75,"Third point"

File: "input.vrt"
    <OGRVRTLayer name="input">
        <LayerSRS>+proj=latlong +datum=WGS84</LayerSRS>
        <GeometryField encoding="PointFromColumns" x="Longitude" y="Latitude"/>

I first tried to run:
# ogr2ogr -f "CSV" -t_srs NAD27 output.csv input.vrt
But I find it just echoes back the CSV file fields.

I also tried changing the command to:
# ogr2ogr -f "ESRI Shapefile" -t_srs NAD27 output.shp input.vrt
but likewise it did not do the reprojection.

The good news is you can convert the CSV/VRT to a SHP file, then reproject that:
# ogr2ogr -f "ESRI Shapefile" wgs84.shp input.vrt
# ogr2ogr -f "ESRI Shapefile" -t_srs "+proj=latlong +datum=NAD27" nad27.shp wgs84.shp

# ogrinfo -al -ro input.vrt > input.vrt.ogrinfo.txt
# ogrinfo -al -ro wgs84.shp > wgs84.shp.ogrinfo.txt
# ogrinfo -al -ro nad27.shp > nad27.shp.ogrinfo.txt

You can then grep out the POINT lines:
# grep POINT *txt
input.vrt.ogrinfo.txt:  POINT (-72.25 48.1 0)
input.vrt.ogrinfo.txt:  POINT (-72.099999999999994 49.200000000000003 0)
input.vrt.ogrinfo.txt:  POINT (-72.75 47.5 0)

wgs84.shp.ogrinfo.txt:  POINT (-72.25 48.1)
wgs84.shp.ogrinfo.txt:  POINT (-72.099999999999994 49.200000000000003)
wgs84.shp.ogrinfo.txt:  POINT (-72.75 47.5)

nad27.shp.ogrinfo.txt:  POINT (-72.250378256963316 48.099999891818264)
nad27.shp.ogrinfo.txt:  POINT (-72.10035130826563 49.200017866444085)
nad27.shp.ogrinfo.txt:  POINT (-72.750373445242744 47.499993395040711)

But as mentioned earlier, the better solution may be cs2cs...

-Mike Newman

-----Original Message-----
From: fwtools-bounces at lists.maptools.org [mailto:fwtools-bounces at lists.maptools.org] On Behalf Of ernst_meier at gmx.de
Sent: Monday, July 20, 2009 11:25 AM
To: fwtools at lists.maptools.org
Subject: [FWTools] (no subject)


i want to reproject some CSV-Data with ogr2ogr but i get only the same result as in my input.

Is it possible to reproject CSV to CSV?

GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
FWTools mailing list
FWTools at lists.maptools.org

More information about the FWTools mailing list