[gdal-dev] tab delimited to shapefile

Kralidis,Tom [Ontario] Tom.Kralidis at ec.gc.ca
Wed Nov 18 14:08:39 EST 2009


I think you can also use the SEPARATOR layer creation option, per
http://www.gdal.org/ogr/drv_csv.html? 

> -----Original Message-----
> From: gdal-dev-bounces at lists.osgeo.org 
> [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of 
> Doug_Newcomb at fws.gov
> Sent: Wednesday, 18 November 2009 13:41
> To: Clay, Bruce
> Cc: gdal-dev at lists.osgeo.org; gdal-dev-bounces at lists.osgeo.org
> Subject: Re: [gdal-dev] tab delimited to shapefile
> 
> Bruce,
> If you're on a linux system with perl:
> 
> perl -pi -e 's/\t/,/g' filename
> 
> is a perl one-liner that should replace all of the tabs with 
> commas in the file, working on the file in place. I've used 
> similar commands on text files up to 379 GB in size, although 
> it does take a while for files that size.
> 
> It does alter the file in place, which can be dangerous. It's 
> best to test on a sample of the file :
> 
> head filename> testfile ( take the first 10 lines of the file 
> and write it to a separate file) perl -pi -e 's/\t/,/' testfile
> 
> If the testfile works fine, use it on the main file.
> 
> 
> Doug
> 
> 
> Doug Newcomb
> USFWS
> Raleigh, NC
> 919-856-4520 ext. 14 doug_newcomb at fws.gov
> --------------------------------------------------------------
> -------------------------------------------
> The opinions I express are my own and are not representative 
> of the official policy of the U.S.Fish and Wildlife Service 
> or Dept. of the Interior. Life is too short for undocumented, 
> proprietary data formats.
> Inactive hide details for "Clay, Bruce" 
> <bclay at ball.com>"Clay, Bruce" <bclay at ball.com>
> 
> 
> 
> 
> 				"Clay, Bruce" <bclay at ball.com> 
> 				Sent by: 
> gdal-dev-bounces at lists.osgeo.org 
> 
> 				11/18/2009 11:09 AM
> 
> 
> 
> To
> 
> <gdal-dev at lists.osgeo.org>	
> 
> 
> cc
> 
> 	
> 
> 
> Subject
> 
> [gdal-dev] tab delimited to shapefile	
> 		
> 
> Is there any way to use ogr2ogr to convert tab-delimited data 
> such as the geoname dot org files into shapefiles short of 
> converting all tabs to commas?
> 
> I created a VRT file that works with CSV files but I can not 
> find any way to convert tab-delimited data.
> 
> Bruce
> 
> 
> 
> 
> This message and any enclosures are intended only for the 
> addressee.  Please  
> notify the sender by email if you are not the intended 
> recipient.  If you are  
> not the intended recipient, you may not use, copy, disclose, 
> or distribute this  
> message or its contents or enclosures to any other person and 
> any such actions  
> may be unlawful.  Ball reserves the right to monitor and 
> review all messages  
> and enclosures sent to or from this email 
> address._______________________________________________
> 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