(no subject)

View: New views
4 Messages — Rating Filter:   Alert me  

(no subject)

by ernst_meier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

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?

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

Re: Reproject CSV Data

by Frank Warmerdam-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ernst_meier@... wrote:
> Hi,
>
> 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?

Ernst,

Does OGR recognise the geometries in the CSV file?  You can determine
this by listing the features in the layer with ogrinfo and see if they
have properly formatted geometries associated with them.

If so, does OGR know the coordinate system?  Most likely not since this
is not read by the CSV driver.

What ogr2ogr commandline did you use?  Did you specify the source and
destination coordinate system?

It is *possible* to reproject from csv to csv with ogr2ogr.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
FWTools mailing list
FWTools@...
http://lists.maptools.org/mailman/listinfo/fwtools
http://fwtools.maptools.org/

Re: (no subject)

by Richard Greenwood :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/7/20  <ernst_meier@...>:
> Hi,
>
> 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?
>
> Ernst

If it is just ASCII coordinates that you are trying to reproject, I
would suggest that you try cs2cs, which is part of Proj4
http://trac.osgeo.org/proj/

ogr2ogr is looking for a spatial field, or object, in the table, like
the .shp file of a shapefile or the .map file of a MapInfo TAB file. A
CSV list of coordinates is just a list, and as such does not have a
spatial object or field. cs2cs would be a more appropriate tool.

HTH,
--
Richard Greenwood
richard.greenwood@...
www.greenwoodmap.com
_______________________________________________
FWTools mailing list
FWTools@...
http://lists.maptools.org/mailman/listinfo/fwtools
http://fwtools.maptools.org/

Re: (no subject)

by Newman, Michael :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Given a test case of two files:

File: "input.csv"
Contents:
-----\
Latitude,Longitude,Name
48.1,-72.25,"First point"
49.2,-72.1,"Second point"
47.5,-72.75,"Third point"
-----/

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

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@... [mailto:fwtools-bounces@...] On Behalf Of ernst_meier@...
Sent: Monday, July 20, 2009 11:25 AM
To: fwtools@...
Subject: [FWTools] (no subject)

Hi,

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?

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

_______________________________________________
FWTools mailing list
FWTools@...
http://lists.maptools.org/mailman/listinfo/fwtools
http://fwtools.maptools.org/