0

i try to send geocode from my tracker to cartodb. It seems like that my coordinate or my sql statement are wrong.

This is the Tracker format: ddmm.mmmmm

Formatting: 
    var val;
    val = parseFloat(geo);
    var dd =  parseInt(val / 100);
    var mmmm = val % 100;
    var res = dd +(mmmm /60);

SQL:
 sql.execute("INSERT INTO test_table(the_geom, imei) VALUES (ST_SetSRID(ST_Point("+info['longitude']+", "+info['latitude']+"),4326),"+info['imei'] +")")

Did i do something wrong?

1

That might be caused by the quotes of the query in the content of the sql.execute() operation.

The next line is an extract of an CARTO.js example that use variables within a SQL query, notice that in order to add the javascript variables within the SQL query (wrapped in double quotes), it use single quotes before and after adding the javascript variables:

sql.execute("WITH point as(SELECT ST_SetSRID(ST_Point('" + lon + "','" + lat + "'),4326)

1
  • Hello, sorry i forget to say carto gets the data but the coordinates are a little bit wrong. It seems like that the coordinates has a offset from 10 m.
    – Taaut
    Sep 16 '16 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.