Ticket #1833 (new enhancement)
full record json output in 9.2 with valid geojson output
| Reported by: | robe | Owned by: | pramsey |
|---|---|---|---|
| Priority: | medium | Milestone: | PostGIS Future |
| Component: | postgis | Version: | 2.0.x |
| Keywords: | Cc: |
Description
9.2 now has native json support. YES. It has a json type and I can output a whole dataset as a single json object with this SWEET command.
CREATE TABLE test(gid serial primary key, title text, geog geography(Point,4326));
INSERT INTO test(title, geog) VALUES('My neck of the woods', ST_GeogFromText('POINT(-71.057811 42.358274)'));
INSERT INTO test(title, geog) VALUES('some other neck of the woods', ST_GeogFromText('POINT(42.358274 -71.057811 )'));
SELECT array_to_json(array_agg(t))
FROM test As t
Ah but our beautiful geography which we have grown to love is not outputting using our json function. We need to rectify this.
[{"gid":1,"title":"My neck of the woods","geog":"0101000020E61000005796E82CB3C3
51C0E98024ECDB2D4540"},{"gid":2,"title":"some other neck of the woods","geog":"0
101000020E6100000E98024ECDB2D45405796E82CB3C351C0"}]
I'm hoping its as trivial as defining a CAST for geography/geometry to json using our ST_AsGeoJSON functions. I'll test that theory out next.
Change History
Note: See
TracTickets for help on using
tickets.
