Node.js でLatからメルカトル座標を取得する必要があります。Lng一部のモジュールを使用できます (たとえば、node-sphericalmercator )。ただし、これは計算が MySQL ではなく Node サーバーで行われることを意味します。
// Here is pseudo code example
var sphericalmercator = new Sphericalmercator();
res = "SELECT ALL lat, lng FROM table"
var rs = res.map(function(row) {
return [sphericalmercator.forward([row.lng, row.lat])]
});
// and only then I can do subsequent INSERTs.
INSERT INTO table VALUES POINTFROMTEXT("POINT(rs[0] rs[1])")
Latしかし、Nodejsサーバーではなく、MySQLに直接Lng変換したいと思います。POINTこれにはいくつかの機能がありますか?
INSERT INTO table VALUES SomeFuncThatTraslatesToPoint(Lng, Lat)