Wordpress GeomFromText
Trying to insert simple Geometry into mysql database from Wordpress:
$wpdb->insert($wpdb->prefix . 'test',
array(
'gps' => 'GeomFromText("POINT('.$longitude.'
'.$latitude.')")'
),
array('%s') );
The error is: Cannot get geometry object from data you send to the
GEOMETRY field.
The issue is that the insert is:
INSERT INTO 'wp_test' ('gps') VALUES ('GeomFromText("Point('0 0')")')
But the insert should be without the apostraphe '.....
INSERT INTO 'wp_test' ('gps') VALUES (GeomFromText("Point('0 0')"))
No comments:
Post a Comment