chrisbull
07/30/2018, 8:43 PMgeometry
stating # Type 'USER-DEFINED' is not yet supported.
.
Here is the SQL query and expected returned value of the column.
SELECT ST_AsGeoJSON(logs.geometry) FROM logs
{ type: "LineString", coordinates: [[-79.895893,40.445344],[-79.895914,40.44529]] }
if I don’t use ST_AsGeoJSON
I get a value with only A-Z0-9 characters, such as 010200000002000000CE3637A627FD...
That said, when using Prisma, I’d like for Prisma to extract the data by wrapping the query using ST_AsGeoJSON
so that it returns the object geometry: {type: String, coordinates:[[Float]]}
... instead of geometry: String
. I’m also trying to do this easily, with as little of ‘custom’ code as possible.
Does anyone have a solution or workaround that would solve my dilemma?
1. Do I need to need to pull the String and then using JS convert it on the frontend to the object?
2. Or is there a way to get Prisma to pass the query wrapper (eg ST_AsGeoJSON
) so that it returns the object automatically?
3. What do I need to use as type Geometry { type: String, coordinates: [[Float]] }
to get this to work? Right now it’s screaming at me as it doesn’t like the [[Float]]
and that Geometry doesn’t have any relationships in the database.
Any help is greatly appreciated! Thank you