OVF file syntax

Tyler Mitchell tylermitchell at SHAW.CA
Fri Aug 11 20:58:35 PDT 2006


On 11-Aug-06, at 3:57 PM, P Kishor wrote:

> I have a CSV file called 'foo.txt' inside a directory called 'bar'.
> The first row contains column headers. I am trying to construct a
> meaningful OVF file like so, but failing.
>
> <OGRVRTDataSource>
>  <OGRVRTLayer  name="foo">
>  <SrcDataSource>CSV:"C:\\path\\to\\bar"</SrcDataSource>
>  <SrcLayer>foo.txt</SrcLayer>
>  <GeometryField encoding="PointFromColumns" x="LONGITUDE"  
> y="LATITUDE"/>
>  <GeometryType>wkbPoint</GeometryType>
>  </OGRVRTLayer>
> </OGRVRTDataSource>

Hi Puneet,

 From my experience you have to treat the text file as the datasource  
and the (only) layer will have the same prefix.  So don't point to  
the folder, instead point to the file itself as the datasource.   
Also, it seems ogr likes to have the CSV file with a .csv extension.   
Even adding that CSV: prefix doesn't do the trick for me - so rename  
your text file.

So here is what works for me:

$ cat foo.ovf
<OGRVRTDataSource>
<OGRVRTLayer name="foo">
<SrcDataSource>foo.csv</SrcDataSource>
<SrcLayer>foo</SrcLayer>
<GeometryField encoding="PointFromColumns" x="lon" y="lat"/>
<GeometryType>wkbPoint</GeometryType>
</OGRVRTLayer>
</OGRVRTDataSource>

$ cat foo.csv
"lat","lon"
54,124
55,122

Hope it helps,
Tyler



More information about the MapServer-users mailing list