Following is the query : C:>osm2pgsql -c --slim -d osm_1 -U postgres -H localhost -S C:\default.style C:\mumbai_india.osm.pbf

Following is the error on which i am stuck:

Using projection SRS 900913 (Spherical Mercator)
Setting up table: planet_osm_point
NOTICE:  table "planet_osm_point" does not exist, skipping
NOTICE:  table "planet_osm_point_tmp" does not exist, skipping
PREPARE get_way (int4) AS SELECT AsText(way) FROM planet_osm_point WHERE osm_id
= $1;
 failed: ERROR:  function astext(geometry) does not exist
LINE 1: PREPARE get_way (int4) AS SELECT AsText(way) FROM planet_osm...
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Error occurred, cleaning up

Following is the version of osm2pgsql:

osm2pgsql SVN version 0.69-21289M

I am using Windows 7 64bit PC with PostgreSql database installed with pgAdmin4.. I did pass various osm.pbf files in the above query but still getting the same issue. I went through various post and solutions and also created Extension postgis and Extension hstore in the database named osm_1 in pgAdmin4 postgresql but still the same issue..

I re-installed osm2pgsql with the latest version found on Google but still got the same error..

  • Osm2pgsql seems to use deprecated function. It is called ST_AsText nowadays. 900913 may lead to problems as well because it is officially 3857. Perhaps your version is oldish.
    – user30184
    Sep 24, 2016 at 12:23
  • 1
    Did you add the extension Postgis to the db osm_1? Sep 24, 2016 at 12:23

1 Answer 1


Your version of osm2pgsql is outdated, and does not respect changes that were made for Postgis 2.0

You can get the latest windows builds here: https://github.com/openstreetmap/osm2pgsql/issues/472

Alternatively (or if you run into similar problems with Mapnik), you can run the legacy.sql which brings back the old functions to Postgis 2.0: https://stackoverflow.com/questions/18945821/postgresql-install-of-legacy-sql-osm-data-and-posgis-2-0

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.