minad / osm2shp

Convert large OpenStreetMap files to shapefiles (Uses sqlite3 db as temporary storage)
31 stars 15 forks source link

‘read’ is not a member of ‘Osmium::Input’ #7

Open Rudloff opened 10 years ago

Rudloff commented 10 years ago

I get this error when I try to compile:

g++ -ggdb -Wall -Wredundant-decls -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c osm2shp.cc -o osm2shp.o
osm2shp.cc: In function 'int main(int, char**)':
osm2shp.cc:18:17: error: 'read' is not a member of 'Osmium::Input'
osm2shp.cc:18:17: note: suggested alternative:
In file included from /usr/include/boost/config/stdlib/libstdcpp3.hpp:76:0,
                 from /usr/include/boost/config.hpp:44,
                 from /usr/include/boost/tr1/detail/config.hpp:164,
                 from /usr/include/boost/tr1/memory.hpp:8,
                 from /usr/include/osmium/osm/object.hpp:33,
                 from /usr/include/osmium/osm.hpp:38,
                 from /usr/include/osmium.hpp:109,
                 from osm2shp.cc:5:
/usr/include/unistd.h:357:16: note:   'read'
make: *** [osm2shp.o] Error 1
eren commented 9 years ago

I get the same error. It seems that the project is no longer maintained. Should we try to find alternatives for converting osm data to shapefile?

minad commented 9 years ago

I don't know if there are other projects which do that? I think there is a lot of movement going in the osm community. Maybe I could get this running again if many people are interested.

eren commented 9 years ago

Currently the only seamless and working solution is to use postgresql. I've tried postgresql and confirm that it's working.

1- Install osm2pgsql (it's present in ubuntu repositories and correctly packaged, which installs required dependencies as well) 2- Create postgresql database with postgis extension 3- Use osm2pgsql to insert osm data into postgresql 4- Use pgsql2shp tool to dump postgres databases.

In my case, osm2pgsql created the following tables:

 public | planet_osm_line    | table | gis
 public | planet_osm_point   | table | gis
 public | planet_osm_polygon | table | gis
 public | planet_osm_roads   | table | gis

I then used the following one-liner to dump those tables:

for i in {line,point,polygon,roads}; do pgsql2shp -f output$i -h localhost -u gis -P PASSWORD DATABASE planet_osm_$i; done

The process is a bit long. It would be good to have a tool that can operate on file. Rather than importing to database, and exporting it, operating solely on file is preferred. That's your choice, sir. If you have time, it would be awesome.

I can help package the app for ubuntu/debian when it's ready.

Btw, for those people who are visiting this page, I found pre-built shape data here. However, this page only provides country-level. If you want to extract a city or a specific region other than a whole country, the region should be downloaded from overpass api, and converted to shp.

abdultz commented 9 years ago

You could just refer to the old Osmium instead of installing the new Osmium libraries https://github.com/joto/osmium Put the include files (and osmium.hpp) from the above in /usr/include $> make then should succeed...