GDAL 1.10 ogr2ogr OSM – Unable to Open Datasource

gdalogr2ogropenstreetmap

I have a problem with ogr2ogr and osm file.

I install from source (on Ubuntu 12.04.2 LTS) newest GDAL libary and OGR still can't read osm files.

gdal-config --version
1.10.0
ogr2ogr --version
GDAL 1.10.0, released 2013/04/24
ogrinfo
Supported Formats:
  -> "ESRI Shapefile" (read/write)
  -> "MapInfo File" (read/write)
  -> "UK .NTF" (readonly)
  -> "SDTS" (readonly)
  -> "TIGER" (read/write)
  -> "S57" (read/write)
  -> "DGN" (read/write)
  -> "VRT" (readonly)
  -> "REC" (readonly)
  -> "Memory" (read/write)
  -> "BNA" (read/write)
  -> "CSV" (read/write)
  -> "GML" (read/write)
  -> "GPX" (read/write)
  -> "KML" (read/write)
  -> "GeoJSON" (read/write)
  -> "GMT" (read/write)
  -> "PostgreSQL" (read/write)
  -> "PCIDSK" (read/write)
  -> "XPlane" (readonly)
  -> "AVCBin" (readonly)
  -> "AVCE00" (readonly)
  -> "DXF" (read/write)
  -> "Geoconcept" (read/write)
  -> "GeoRSS" (read/write)
  -> "GPSTrackMaker" (read/write)
  -> "PGDump" (read/write)
  -> "GPSBabel" (read/write)
  -> "SUA" (readonly)
  -> "OpenAir" (readonly)
  -> "PDS" (readonly)
  -> "HTF" (readonly)
  -> "AeronavFAA" (readonly)
  -> "EDIGEO" (readonly)
  -> "SVG" (readonly)
  -> "Idrisi" (readonly)
  -> "ARCGEN" (readonly)
  -> "SEGUKOOA" (readonly)
  -> "SEGY" (readonly)
  -> "ODS" (read/write)
  -> "XLSX" (read/write)
  -> "PDF" (read/write)

When I try this:

ogrinfo UMP-PL-CCBySA_20130717.osm

and I get this:

ERROR 0:
FAILURE:
Unable to open datasource `UMP-PL-CCBySA_20130717.osm' with the following drivers.
Supported Formats:
  -> "ESRI Shapefile" (read/write)
...
...

Anyone know what I do wrong?

Best Answer

# Start with a clean copy of the svn source code repo:
$ svn co http://svn.osgeo.org/gdal/trunk/gdal

$ cd gdal

# Run configure and check its output, which should say something like:
$ ./configure
...
...
  Expat support:             yes
...
  SQLite support:            yes
...

# If it doesn't, check config.log to locate the problem(s) 
# and consult ./configure --help on how to fix them

# Once you configured correctly, run
$ make

# Then check the supported formats with
$ ./apps/ogrinfo --formats 

# Eventually, you run
$ sudo make install