Impletement MapD point map in UI with node js backend


Thank you for creating such a wonderful platform.

I had a doubt regarding UI implementation of the point map as shown in the tweet map example

We want to show point map in our UI while fetching the data from the node js backend as we don’t want to expose our DB credentials and I’m not able to find a proper way to implement point map.

I’d be really grateful if someone could guide me about it.


hello @krunalshah68,

Thanks for using mapd and checkout out some of our examples. While your use case is certainly possible, it will require some non-trivial changes to the charting library.

The gist of how the raster (backend rendered) charts work is that they generate a JSON object that is then sent to the backend via the mapd-connector’s renderVega method. It is at this line where the actual call is made.

As I see it you have two options:

  1. Stub out mapd-connector library replacing the methods which issue sql to the backend with methods that issue requests to your node proxy server. These methods would most likely be query and renderVega.

  2. Replace the line in the raster-chart file that makes the .con().renderVega call with a call to your backend. This should be the simplest approach, however I’m not sure if that is the only call required to get the raster charts to render, there may be additional query calls required earlier on in the setup process. Additionally crossfilter is instantiated with an instance of mapd-connector so you may also have to make some changes there.

Once you’ve done this you would use the node version of the mapd-connector library to issue requests to the mapd backend via your node proxy.

While all this is possible, and seemingly straight forward, I cannot guarantee that it will be as simple as it appears.

Best of luck and let us know how it goes!


Hello @tai ,

Thank you so much for your reply.
Will surely try out your solution and let you know.

Thanks again.


hello @krunalshah68,

I am stumbling upon the same use-case and question: have you been able to test one or the other solution?

The other thing I could think of is the backend rendering the base64 image returned from render_vega but in that case we lose the chart interactivity and other functionalities.