I need to visualize PostGIS Geometry column as an overlay of a Leaflet tiled Map. I started a question here ,but didn't get any simple and satisfied answer. So I am starting this question. I got an option on Github to convert the PostGIS column to GeoJSON which can be visible through leaflet map.

I used the url as follows


but it returns the following errors

Notice: Undefined index: parameters in C:\wamp\www\pgsql\PostGIS_GeoJSON.php on line 52

Notice: Undefined index: orderby in C:\wamp\www\pgsql\PostGIS_GeoJSON.php on line 54

Notice: Undefined index: limit in C:\wamp\www\pgsql\PostGIS_GeoJSON.php on line 61

Notice: Undefined index: offset in C:\wamp\www\pgsql\PostGIS_GeoJSON.php on line 63

Warning: pg_query() [function.pg-query]: Query failed: ERROR: function transform(geometry, integer) does not exist LINE 1: SELECT *, st_asgeojson(transform(geom,4326)) AS geojson FROM... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. in C:\wamp\www\pgsql\PostGIS_GeoJSON.php on line 89
An SQL error occured.

What I have to do?

1 Answer 1


The code you are using uses the older function naming style without the "ST_" prefix, used many many years ago. So transform(geometry, integer) is now ST_Transform(geometry, integer).

There are a few things you can do to fix this. Do one of these:

  • Fix the PHP code, by changing transform to ST_Transform
  • Apply the legacy.sql enabler script from the PostGIS contrib directory (documented here)
  • Thank you very much for your reply. Can you explain little more how to enable legacy.sql script from PostGIS contrib directory? Jan 7, 2013 at 6:36
  • @DevilsDream updated answer. You will need to locate the legacy.sql for your system (it depends on what you have installed).
    – Mike T
    Jan 7, 2013 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.