MySQL Forums
Forum List  »  Newbie

Accessing geoJSON data using ST_AsGeoJSON function
Posted by: swar leong
Date: January 13, 2021 12:15PM

I want to get geoJSON objects from a column inside a mysql table.

Using the ST_AsGeoJSON(column name), I am able to get the data via axios, with the following results:

{status: 200, data: Array(5), message: "Bench lists retrieved successfully"}

The array of objects returned are formatted like this:

ST_AsGeoJSON(the_geom):
coordinates: Array(2)
0: -73.94928
1: 40.71114
type: "Point"


I want to access the coordinates key using this:

ST_AsGeoJSON(the_geom).coordinates

However it returns undefined because it doesn't recognise ST_AsGeoJSON(the_geom).

How can I get a response without the function ST_AsGeoJSON showing in the results?

Options: ReplyQuote


Subject
Written By
Posted
Accessing geoJSON data using ST_AsGeoJSON function
January 13, 2021 12:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.