Creating GeoJson collection from Postgis table in a schema other than public

المشرف العام

Administrator
طاقم الإدارة
I've to create a GeoJson collection (geometry + attributes) from a select and I tested this instructions: http://www.postgresonline.com/journ...lections-with-JSON-and-PostGIS-functions.html .I've Postgres 9.3 and PostGIS 2.1 in public schema.On my data, the fist select doesn't work, the second works but only on tables in public schema.For example:

SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type , ST_AsGeoJSON(lg.geom)::json As geometry , row_to_json((SELECT l FROM (SELECT ditta, stato ) As l )) As properties FROM discariche_pti As lg ) As f ) As fc;

doesn't gives errors, while:

SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type , ST_AsGeoJSON(lg.the_geom)::json As geometry , row_to_json((SELECT l FROM (SELECT CODICE_PRO, NOME_PROV ) As l )) As properties FROM territorio.province As lg ) As f ) As fc;

doesn't work.Any ideas? Thanks



أكثر...
 
أعلى