[postgis-users] How do I handle a ResultSet from a java request?
drsockmonkee at gmail.com
Tue Oct 6 06:32:39 PDT 2015
I'm sending my first question out so patience please.
I've got a working servlet on my server that will query for and get
information back from my postgis DB.
Up until now I have been just parsing the results and sending back a json
string. I want to get a GeoJSON back from my db now.
I've been working through the information I found here:
I can create the table with locations included and a geog value, and I can
run the query below
FROM ( SELECT 'FeatureCollection' As type,
array_to_json(array_agg(f)) As features
FROM (SELECT 'Feature' As type
, ST_AsGeoJSON(lg.geog)::json As geometry
, row_to_json((loc_id, loc_name)) As properties
FROM locations As lg ) As f ) As fc;
which brings back a single line string and is in the correct format
all in PGAdmin3.
I have been trying to duplicate this from my server with java and am
stuck at the point where I have
run the query and have a 'thing' (ResultSet) but am unsure as to how
to handle it and then pass it
back to the client.
Any help would be welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users