Hello folks.
I am playing around with using a PostGIS enabled database in Livebook (with Maplibre).
I figured out how to add Postgrex types to handle the Geometry type used by PostGIS. However, when trying to reference the results of a query in LiveBook through the following query:
stations = Postgrex.query!(conn, "select * from bc_stns limit 100", [])
then trying to reference a field in the query results:
geo_pts = stations.geom
I get the following error. I am missing something basic, but cannot figure it out.
** (KeyError) key :geom not found in: %Postgrex.Result{
command: :select,
columns: ["id", "station_number", "station_name", "prov", "hyd_status",
"drainage_area_gross", "drainage_area_effect", "geom", "latitude",
"longitude", "from_year", "to_year", "record_length", "regulated",
"reg_from", "reg_to", "station_id"],
rows: [
[
4858,
"07EA001",
"FINLAY RIVER AT WARE",
"BC",
"D",
11100.0,
nil,
%Geo.Point{
coordinates: {-125.62639, 57.42083},
srid: 4269,
properties: %{}
},
57.42083,
-125.62639,
1960,
1983,
23,
false,
nil,
nil,
4858
],
All help is appreciated.
Thanks.
DJ