Ogr csv file access

Frank Warmerdam warmerdam at POBOX.COM
Fri Sep 7 16:37:31 EDT 2007


Kedaar Ghanekar wrote:
> Hi,
> 
> I am trying to access a csv file with x,y point data using OGR.  I have 
> it working using ODBC however I am not able to access the files without 
> ODBC which I would like to do.  I am using ms4w on a windows XP box and 
> was not able to access my csv files using the method described here:
> http://lists.umn.edu/cgi-bin/wa/cgi-bin/wa?A2=ind0603&L=mapserver-users&D=0&P=63569&X=24C17728765623E608 
> <http://lists.umn.edu/cgi-bin/wa/cgi-bin/wa?A2=ind0603&L=mapserver-users&D=0&P=63569&X=24C17728765623E608>
> 
> And at the bottom of the page here:
> http://mapserver.gis.umn.edu/docs/reference/vector_data/VirtualSpatialData
> 
>  >From what I understood of the OGR document on the mapserver website it 
> says that csv files can be accessed directly by entering the path to the 
> file in the SrcDataSource, but this does not seem to be working for me.
> 
> Here is the connection string that I am trying to use:
> CONNECTION "<OGRVRTDataSource>
> <OGRVRTLayer  
> name='city'><SrcDataSource>C:\ms4w\apps\sp-wms\admin_tools\data\ReportData\</SrcDataSource><SrcLayer> 
> city.csv</SrcLayer><GeometryField encoding='PointFromColumns' x='X' 
> y='Y'/><GeometryType>wkbPoint</GeometryType><LayerSRS>WGS84</LayerSRS></OGRVRTLayer></OGRVRTDataSource>"   
>  
> 
> Here is the working ODBC version:
> CONNECTION "<OGRVRTDataSource>
> <OGRVRTLayer  
> name='IRSS_TEXT'><SrcDataSource>ODBC:IRSS_TEXT,city.csv</SrcDataSource><SrcLayer>city.csv 
> </SrcLayer><GeometryField encoding='PointFromColumns' x='X' 
> y='Y'/><GeometryType>wkbPoint</GeometryType></OGRVRTLayer></OGRVRTDataSource>"

Kedaar,

I would suggest that you start by trying "ogrinfo" against the .csv file
and see if that works.  If not, perhaps you could provide me the first
few lines of the file.  The .csv driver has a quite a bit more restrictive
concept of format than the windows ODBC csv driver.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list