[gdal-dev] (no subject)
Even Rouault
even.rouault at mines-paris.org
Fri Nov 8 13:46:18 PST 2013
Le vendredi 08 novembre 2013 22:41:07, Federico Jurio a écrit :
> Hi all, I have a csv file named test.csv with the asociated test.vrt
>
> *test.vrt*
> <OGRVRTDataSource>
> <OGRVRTLayer name="test">
>
> <SrcDataSource>C:\\Users\\FedericoJurio\\Desktop\\test.csv</SrcDataSource>
> <GeometryType>wkbPoint</GeometryType>
> <LayerSRS>WGS84</LayerSRS>
> <GeometryField encoding="PointFromColumns" x="Longitude"
> y="Latitude"/>
> </OGRVRTLayer>
> </OGRVRTDataSource>
>
> *test.csv*
> Latitude,Longitude,Name
> 48.1,0.25,"First point"
> 49.2,1.1,"Second point"
> 47.5,0.75,"Third point"
>
> In my code i can add the vrt file to the datasource successfully but when i
> try to check the TestCapability(OLCRandomRead) from the correct layer
> returns FALSE and i don't no why. Gdal can read the file from the console
> with ogrinfo and everithing seems to be fine
>
> *ogrinfo test.vrt*
> INFO: Open of `test.vrt'
> using driver `VRT' successful.
> 1: test (Point)
>
> Does anyone have any idea of why TestCapability returns false?
Quoting http://gdal.org/ogr/ogr__api_8h.html#a480adc8b839b04597f49583371d366fd
:
"""OLCRandomRead / "RandomRead": TRUE if the GetFeature() method is
implemented in an optimized way for this layer, as opposed to the default
implementation using ResetReading() and GetNextFeature() to find the requested
feature id."""
The organization of a CSV file doesn't allow *efficient* random access, hence
TestCapability(OLCRandomRead) return FALSE. This doesn't prevent random
reading from being possible. It will be just slow (on a file with several
thousands of records... not a 3 line file ;-)). And ogrinfo just needs efficient
sequential reading, which CSV allows.
>
> Thanks in advance,
> Regards
--
Geospatial professional services
http://even.rouault.free.fr/services.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20131108/58f08b61/attachment.html>
More information about the gdal-dev
mailing list