I created a dataset in CartoDb using a CSV and created a map . After that i updated one record's latitude and longitude using carto api. On Info window i print lat and long and it shows updated value. But marker shows in prvious lat and long position not in updated lat and long position.

1 Answer 1


When you import a dataset into CARTO with latitude and longitude columns, CARTO converts these values into a geometry (and assigning this to the the_geom column). So, if you change again any latitude/longitude values after importing, you should:

a. Georeference again your dataset from the Editor's UI.

b. Update the_geom column using these new values from the SQL console. You can try something like this:

  the_geom = cdb_latlng(latitude, longitude)

*You could use the WHERE clause to limit the update to just the values that you have edited.

c. Update the_geom via SQL API:

https://{username}.carto.com/api/v2/sql?q=UPDATE table SET the_geom = cdb_latlng(latitude, longitude)&api_key={api_key}

After doing any of these options, if you go to your map, the point(s) will be shown on the right (and latest) position.

  • thank u ramiroaznar. its help me a alot. I have another doubt . I want to implement search option in my map. i followed this tutorial bl.ocks.org/oriolbx/14786cdd2dca51f4ec9c . But on loading my map its shows 'Uncaught Error: sql is read-only in NamedMaps' in my console. I changed privacy settings as Public from Link. But issue exists. On searching i got another issue 'Uncaught TypeError: Cannot read property 'setSQL' of undefined'. How can i implement search in my map?
    – BaijuPV
    Commented Sep 6, 2016 at 4:22
  • Please if you think I have answered your question, mark it as solved. Then, post this new question into a new thread. That's how Stack Exchange works. Commented Sep 6, 2016 at 6:04
  • @baijupv please, questions not related with your original topic should be posted separately, otherwise they won't be easily accessible.
    – Jorge Sanz
    Commented Sep 6, 2016 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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