# How can I put OSM data in a geography view in PostGIS?

I loaded the *.osm file to postgis with osm2pgsql. The data are stored in lat/long, so the same time I expect them to should be available in geography view, but they are not (only present in geometry column). Is there any way the osm tables to be visible in geography view? As far as I know I cannot define other unit in function like ST_buffer than the original table is stored in? So for example if the data are in lat/long the function St_buffer will return the distance in degree. Instead of that I would like to be able to execute queries with meter parameters even if the data are stored in lat/long. To do that actually I need the osm tables to be visible in the geography column, Am I right? If so ... how to?

Thanks a lot for an answer, Gregory

-
Does osm2pgsql generates a SQL file?, if it does replace the type of the table that it creates. it should say something like "AddGeometryColumn", should work if you replace that with "AddGeographyColumn" –  pacofvf Mar 29 '12 at 23:53

are you mentioning about nodes, ways and rels tables.

osm2pgsql should be used with many options avalaible. You can find them when you type --help command.

Like the one example here:

osm2pgsql -U postgres -d postgis -S "C:\Program Files\HOTOSM\share\default.style" -k -l -v -c -s -m -E "C:\Program Files\HOTOSM\share\900913.sql" "C:\path\map.osm"


This would not generate a SQL file instead create tables like planet_osm_roads, lines, polygons, points. These tables have a column 'ways', which is of type geom(so u can do all that spatial functions here, also is visible on GIS softwares like QGIS). The tables nodes, ways and rels are the intermediate tables.