[Gdal-dev] CSV of Linestring

Jørn Vegard Røsnes jorn at spacetec.no
Fri Nov 4 05:33:30 EST 2005


Hi all/Frank,

one probably small issue, the VRT driver seems to interpret my Linestrings as 
normal Strings

ogrinfo <shapefile>
<snip>
id: String (80.0)
LINESTRING: String (80.0)
OGRFeature(internationals):0
  id (String) = 1
  LINESTRING (String) = LINESTRING (1182671.21 7954218.71
<snip>

This is ogrinfo from a working Linestring shapefile:
OGRFeature(border):1
  FNODE_ (Real) =           3
  TNODE_ (Real) =           5
  LPOLY_ (Real) =           0
  RPOLY_ (Real) =           0
  LENGTH (Real) =      8365.013
  BORDER_ (Real) =           2
  BORDER_ID (Real) =         110
  LINESTRING (1078197.5 -1851469.5,1077982.5 -1851531.25,1077456.125 
-1851837.375,1076802.625 -1852318.0,1076262.5
 -1852786.25,1076109.875 -1853430.5,1076323.625 -1854017.625,1076828.625 
-1854581.125,1077860.625 -1854837.625,107
8835.5 -1854426.5,1079887.25 -1854060.25,1080611.875 -1853993.875)


My CSV file (some of):
id, LINESTRING
1, LINESTRING (1182671.21 7954218.71,1182923.04 7954570.63,1185138.41 
7957665.21,1187360.57 7960754.83,1188034.93
7961681.60)
 2, LINESTRING (1182671.21 7954218.71,1182671.21 7954218.71)

my VRT file:
<OGRVRTDataSource>
    <OGRVRTLayer name="internationals">
        <SrcDataSource 
relativeToVRT="0">/path/to/international.csv</SrcDataSource>
        <SrcLayer>international</SrcLayer>
        <GeometryType>wkbLineString</GeometryType>
        <GeometryField encoding="WKB" field="LINESTRING"/>
        <LayerSRS>epsg:32633</LayerSRS>
    </OGRVRTLayer>
</OGRVRTDataSource>

All ideas are welcome?
I've also tried different names for the WKB-field than "LINESTRING".

Best Regards
Joern

>
> Jørn,
>
> As it turns out, the OGR CSV driver does not consider the file
> to be a .csv file if it does not have at least two fields.  Try
> adding an "ID" field or something.
>
> 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    |
> Geospatial Programmer for Rent



More information about the Gdal-dev mailing list