LibPQ.jl
LibPQ.jl copied to clipboard
Example / Docs for working with PostGIS
Would be great to know how to work with geometries in Julia. For example,
data = execute(conn,
"""
SELECT ST_SetSRID(ST_MakePoint(lon, lat), 4326) AS geom
FROM tbl;
""",
not_null = true) |>
DataFrame
Which package in Julia would be recommended to parse the String to a geometry in Julia?
You would probably want to use https://github.com/JuliaGeo/LibGEOS.jl
I would recommend using the PostgreSQL function ST_AsEWKT in your query and then parsing with readgeom from LibGEOS.jl. Or you could use ST_SetSRID(ST_MakePoint(lon, lat), 4326)::bytea in your query and parse with readgeom.
This would be a good example case to talk about how to do type conversions in LibPQ.jl