2

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

http://localhost:8080/pgsql/PostGIS_GeoJSON.php?geotable=bgd_adm3&geomfield=geom

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?

Devils Dream
  • 3,179
  • 9
  • 44
  • 78

1 Answers1

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)
Mike T
  • 42,095
  • 10
  • 126
  • 187
  • Thank you very much for your reply. Can you explain little more how to enable legacy.sql script from PostGIS contrib directory? – Devils Dream Jan 07 '13 at 06: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 07 '13 at 07:37