This is a note for myself, and details the lessons I have learned whilst trying to load an .osm file into a PostGIS 2.0 database.

1. don´t use osmosis, due to the fact it seems to be rarely updated and suffers from this problem which I could not solve - http://wiki.openstreetmap.org/wiki/64-bit_Identifiers.

2. osm2pgsql is much better, but for it to work with PostGIS 2.0 I had to rename the "st_astext(geometry)" function to "astext(geometry)" as otherwise it throws an error. (the old filename refers to a previous version of Postgis that used different naming conventions)

3. despite using the --password and -W flag, the postgis datbase threw an error as it required the password. Therefore I had to change the 'md5' permission for a local user to 'trust' so that no password was necessary in the pg_hba.conf file.

4. I had to paste the following code in SQL to create an operator that was missing in the PostGIS 2.0 distribution

CREATE OPERATOR CLASS gist_geometry_ops

FOR TYPE geometry USING GIST AS

STORAGE box2df,

OPERATOR 1 << ,

OPERATOR 2 &<

,

OPERATOR 3 && ,

OPERATOR 4 &>

,

OPERATOR 5 >>

,

OPERATOR 6 ~=

,

OPERATOR 7 ~

,

OPERATOR 8 @

,

OPERATOR 9 &<| ,

OPERATOR 10 <<| ,

OPERATOR 11 |>> ,

OPERATOR 12 |&> ,

OPERATOR 13 <-> FOR ORDER BY pg_catalog.float_ops,

OPERATOR 14 <#> FOR ORDER BY pg_catalog.float_ops,

FUNCTION 8 geometry_gist_distance_2d (internal, geometry, int4),

FUNCTION 1 geometry_gist_consistent_2d (internal, geometry, int4),

FUNCTION 2 geometry_gist_union_2d (bytea, internal),

FUNCTION 3 geometry_gist_compress_2d (internal),

FUNCTION 4 geometry_gist_decompress_2d (internal),

FUNCTION 5 geometry_gist_penalty_2d (internal, internal, internal),

FUNCTION 6 geometry_gist_picksplit_2d (internal, internal),

FUNCTION 7 geometry_gist_same_2d (geom1 geometry, geom2 geometry, internal);