5

I've been asked to add a form to a map that will write data in the background (e.g., ajax to a magic file that does datawrites and some emailing, notifications etc) and a new marker will be added to the map being displayed.

I have done this before with CartoDB SQL api. Sent all the form data to a magic ajax script that wrote the new info to the database, then the front-end would refresh the map to show the new marker.

So that's fine, and I had intended upon copying my code over wholesale, but then I found out this is in MapBox ... Is there any way to write to the MB database? or will i need to re-work the entire map storing the data elsewhere ?

5
  • 1
    What data are you referring to? The data behind their maps? That's all OpenStreetMap data... Commented Mar 4, 2014 at 20:38
  • I am referring specifically to the data that would make the front-end happen, not openstreetmap. E.g., the list of markers and county polygons and their associated numbers (counts of accidents, etc). It is into that data I want to insert a record.
    – vaxhax
    Commented Mar 4, 2014 at 20:51
  • 1
    Oh... I'm not sure if Mapbox has an API to write to one of their map 'data' tables, as oppose to a hosted map tile set... Commented Mar 4, 2014 at 20:53
  • 1
    Mapbox allows you to design and publish maps which work very fast and they precut your map tiles based on your definitions of style and zoom. CartoDB works from a dynamic database, so anytime data is changed, you to access that changed data or request tiles that reflect that new data. They are quite different and even work well together in many cases. But no, if you need a SQL API, you'll need CartoDB. Commented Mar 5, 2014 at 15:44
  • can you share how it's done, on a free account on Carto?
    – Nikhil VJ
    Commented Oct 10, 2017 at 15:10

1 Answer 1

5

You've hit on the major difference between CartoDB and MapBox. CartoDB provides an in-browser geodatabase that you can store your data in, and interact with easily via API. MapBox (if you're making your own custom layers) requires you to create tiles in TileMill, and you can interact with those pre-made tiles, but you can't access or change the underlying data once you've created your tiles (as far as I know).*

This is the main reason I use CartoDB. You can make really beautiful maps with MapBox arguably more easily than CartoDB, but the second you want to do live data interactivity, CartoDB is much easier, especially if you're like me and don't have the time or interest to learn how to spin up your own geoDB, or want to deal with figuring out how to like link to an external-to-MapBox csv for marker points, etc :) Maybe for your case something like that external csv will work though!

*at least this was my assessment about 6 months ago when I was deciding between tools. MapBox is adding functionality all the time though, so maybe someone else knows better!

1
  • can you share how it's done, on a free account on Carto?
    – Nikhil VJ
    Commented Oct 10, 2017 at 15:10

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.