JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.37k stars 694 forks source link

Support for Geometry Column type #1439

Open Shashank-Nous opened 2 years ago

Shashank-Nous commented 2 years ago

Do Kotlin Exposed support Geometry column type?

I have a table defined as follows:

'CREATE TABLE `location` (
  `ID` char(32) NOT NULL,
  `Org` char(32) DEFAULT NULL,
  `Location` char(32) DEFAULT NULL,
  `coordinates` geometry NOT NULL,
  PRIMARY KEY (`ID`),
  SPATIAL KEY `coordinates` (`coordinates`)
)

I need to write a query to fetch the location based on coordinates, here is query:

SET @g = ST_GeomFromText('POINT(-73.95736819580677 40.67380811099114)');

SELECT id,org,location,ST_AsText(coordinates) AS coordinates,
ST_X(coordinates) AS longitude, ST_Y(coordinates) AS latitude
FROM sosdb.locationlatlong
WHERE
ST_Distance_Sphere(coordinates, @g) < '2800';
neo-turak commented 3 months ago

I tested 0.52.0, unfortunately has not supported yet. Also I am confused that how to get the MySql POINT data type.

joeyk16 commented 3 weeks ago

Hi @Shashank-Nous curious if you found a work around? I have the same issue. I have 100's of locations that i need to find the closest based a coordinate.