-
-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't insert a POINT geometry value #884
Comments
The solution I found was to embed the const location = {
latitude: 45,
longitude: -80,
};
const [result] = await db.query<ResultSetHeader>(
'INSERT INTO `events` (user_id, dt, coordinate) VALUES (?, NOW(), POINT(?, ?))',
[userId, location.longitude, location.latitude],
); Remember that latitude is north/south, so it is the |
Nice, and could you insert 2 points in bulk? It drives me nuts that I cannot :-( |
@a613 @pihentagy linking my answer to a related issue #1244 (comment) |
@davegriffin see linked answer. If you feel that it should be explicitly mentioned in the documentation feel free to open a PR to start discussion, closing this for now |
I'm sure this more of a documentation issue rather than a code one, but I cannot find any examples of how to encode a POINT value in an INSERT statement. (Issue #234 doesn't explicitly state how this is resolved.) Every variation I have tried returns:
message: 'Cannot get geometry object from data you send to the GEOMETRY field',
code: 'ER_CANT_CREATE_GEOMETRY_OBJECT',
Installed: [email protected]
I have tried using the x,y object:
and I have tried using the POINT string:
Destination schema is:
I would be happy to update the docs with details on GEOMETRY columns.
Thank you.
The text was updated successfully, but these errors were encountered: