-1

I'm trying to build a congressional district map with Cartojs. cartodb.createVis function takes in a vizjson object, so I'm looking for a vizjson link for congressional districts. I have been able to find vizjson links for US county-specific maps and European maps, but I'm looking for a vizjson link that has congressional districts, or for instructions on how I would create my own vizjson file for that since there are already shapefiles/existing datasets for congressional districts.

Another note is that when I used Carto Builder a congressional map was one of the free public datasets. I'm not able to extract this information in the form of a vizjson file though (seems like Carto Builder isn't entirely compatible with Cartojs yet) but perhaps there is a work-around this?

Please advise! Thank you.

Kim Ngo
  • 103
  • 2

1 Answers1

0

Looking for a vizjson could not be the best approach in this case because of two reasons. On the one hand, CARTO users do not usually share their vizjsons, and on the other, as you have pointed out CARTO.js current version is not compatible with BUILDER vizjsons. So I would recommend following these steps to create a CARTO.js map application:

  1. Connect this "congressional district" dataset from the Data Library into your CARTO account.
  2. Use createLayer method instead of createVis, setting the districts dataset as a subLayer. Here you have a working example.
ramiroaznar
  • 266
  • 5
  • 15