I have a csv file containing lon,lat coordinates. I want to create a vector layer (points with the lon/lat coordinates) using ogr2ogr.

I did the following:

ogr2ogr -f "ESRI Shapefile" "vector.shp" "coords.csv" -oo X_POSSIBLE_NAMES=lon* -oo Y_POSSIBLE_NAMES=lat* -a_srs EPSG:4326 -nlt POINT -skipfailures

The result is a shapefile with no geometry values. Do I have to define anything else in the above command?

A sample of the coords.csv is as following:

Lon_rounde  Lat_rounde  ISO3    Year    GNFR_Secto  SourceType  CH4
-17.05  32.675  PRT 2015    A   A   57.69167458

I also tried to use the whole name of lon, lat (with the same result) :

> ogr2ogr -f "ESRI Shapefile" "vector.shp" "coords.csv" -oo
> X_POSSIBLE_NAMES= Lon_rounde -oo Y_POSSIBLE_NAMES=Lat_rounde -a_srs
> EPSG:4326 -nlt POINT -skipfailures
  • Add a sample of your csv file with the header line (if you have a header line) and one data line.
    – user30184
    Commented Jun 26, 2019 at 5:51
  • @user30184 I edited my question.
    – nat
    Commented Jun 26, 2019 at 5:59
  • 1
    What is your GDAL version (ogrinfo --version)?
    – user30184
    Commented Jun 26, 2019 at 6:06
  • I use GDAL 2.1.0dev with GEOS support
    – nat
    Commented Jun 26, 2019 at 6:43

1 Answer 1


I solved the problem by using GDAL v2.4 (with v2.1 was not working)

  • I suppose that the part that was not working was just the use of POSSIBLE_NAMES open option that was new to 2.1 release version gdal.org/drivers/vector/csv.html. Reading through the .VRT file should have worked.
    – user30184
    Commented Jun 26, 2019 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.