[gdal-dev] cannot open shape file created in linux in windows

gaffigan at sfos.uaf.edu gaffigan at sfos.uaf.edu
Tue Mar 18 04:02:32 EDT 2008


Xiaodong,

Good morning.  I'm not sure why the example wouldn't work on your machine.
 When I paste the lines below into my linux terminal window, I get the
result shown on the csv driver page.  I tried the example without error on
a number of machines, with GDAL versions ranging from 1.5.0 to 1.3.1.  You
could confirm that the VRT driver is enabled, but I thought it always is.
  ogrinfo --formats     # look for "VRT"

Steve

cat > test.csv <<EOF
Latitude,Longitude,Name
48.1,0.25,"First point"
49.2,1.1,"Second point"
47.5,0.75,"Third point"
EOF
cat > test.vrt <<EOF
<OGRVRTDataSource>
    <OGRVRTLayer name="test">
        <SrcDataSource>test.csv</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <LayerSRS>WGS84</LayerSRS>
        <GeometryField encoding="PointFromColumns" x="Longitude"
y="Latitude"/>
    </OGRVRTLayer>
</OGRVRTDataSource>
EOF
ogrinfo -ro -al test.vrt


> Hello Steve,
>
> Thanks for offering help. Trying
>
> ogr2ogr -f "ESRI Shapefile" grid.shp grid.vrt -nlt multipoint
>
> I got error message, saying 'Unable to open data source grid.vrt with
> the following drivers', followed by a list of drivers, including ESRI
> Shapefile, CSV, among others.
>
> Actually, I got the same error message when running ogrinfo -ro -al
> test.vrt, using the exact same example listed in the page you referred to,
>
> http://www.gdal.org/ogr/drv_csv.html
>
> Any idea?
>
> Xiaodong
>
> gaffigan at sfos.uaf.edu wrote:
>> Hello.  You might try the following:
>>   ogr2ogr -f "ESRI Shapefile" grid.shp grid.vrt -nlt multipoint
>>
>> The important part is that the source dataset is the vrt definition
>> file,
>> not the csv data file.  See http://www.gdal.org/ogr/drv_csv.html.
>>
>> Hopefully it's this easy.
>>
>> Steve
>>
>>
>>
>>> Hi,
>>>
>>> I used --- ogr2ogr -f "ESRI Shapefile" grid grid.csv -nlt multipoint
>>>
>> ----- to convert a series of points (in csv format) into a shape file of
>> multiple points. I also have a grid.vrt and a grid.csvt file that are
>> used in this conversion. A directory named grid was created and under it
>> there are 3 files, namely, grid.shp, grid.dbf, and grid.shx. Using
>> ogrinfo grid returns,
>>
>>> INFO: Open of 'grid', using driver 'ESRI Shapefile" successful. 1:grid
>>>
>> (multi point).
>>
>>> Also using ogrinfo -ro -al grid returns a series of records, and the
>>>
>> last one is
>>
>>> OGRFeature (grid): 5374
>>> long (Real) = -100.08310911830001
>>> lat (Real) = 44.963133226799997
>>> data (Real) = 3
>>> mapped dat (Real) = 68.000000000
>>>
>>> The above commands were executed in Linux with gdal installed. After
>>>
>> transferring grid folder to windows, I can open them, but nothing show
>> up (I tried ENVI and FWTool). For example, in FWTool, it seemed that the
>> shape file can be opened, but this is what showed in the Shape
>>
>>> Attributes window,
>>>
>>> Where did I do wrong?
>>>
>>> Thanks
>>> Xiaodong
>>> _______________________________________________
>>> 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