Extract TopoJSON directly from PostGIS

المشرف العام

Administrator
طاقم الإدارة
I have a simple "region" table: id (TEXT), name (TEXT), geom (MULTIPOLYGON). Here's the query I can use to extract a GeoJSON FeatureCollection:

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(region.geom)::json AS geometry, row_to_json((SELECT l FROM (SELECT id, name) AS l ) ) AS propertiesFROM region) AS f) AS fc;Is there any equivalent query that can be used to extra TopoJSON instead? I'm aware of AsTopoJSON but no idea how to use.



أكثر...
 
أعلى