[postgis-tickets] [PostGIS] #3687: Add casts for (geometry, geography) -> (json, jsonb)
PostGIS
trac at osgeo.org
Mon Jan 16 13:27:03 PST 2017
#3687: Add casts for (geometry, geography) -> (json, jsonb)
-------------------------+---------------------------
Reporter: dbaston | Owner: dbaston
Type: enhancement | Status: new
Priority: medium | Milestone: PostGIS 2.4.0
Component: postgis | Version: trunk
Keywords: |
-------------------------+---------------------------
Any reason not to do this? It seems as simple as
{{{
CREATE FUNCTION geometry_json_cast (geometry) RETURNS json
AS $$ SELECT ST_AsGeoJSON($1)::json $$ LANGUAGE SQL;
CREATE CAST (geometry AS json) WITH FUNCTION geometry_json_cast(geometry);
}}}
Built-in functions like {{{row_to_json}}} will automatically pick up this
cast and use it when converting geometries to JSON values.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3687>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list