Cómo aplicar un filtro y una malla a un D3 Choropleth

Estoy trabajando con una variación deChoropleth Cuantil de Bostock.

He escalado con éxito la proyección e integrado mis propios datos. Actualmente también estoy filtrando los datos de los condados de json para incluir solo identificadores de condado que comienzan con la identificación estatal de 48.

Todo funciona perfectamente, sin embargo, todavía necesito aplicar la función .mesh para combinar los arcos entre los condados limítrofes. De lo contrario, cuando agrego un efecto de desplazamiento, obtengo bordes extrañamente desiguales.

Intenté reemplazar la llamada de datos con una llamada de referencia (malla) en su lugar (ver la línea comentada a continuación) Pero no funcionó.

Aquí está mi código de trabajo:

function ready(error, us) {
  if (error) throw error;

    //define the feature of the states from the topojson file, then filter so only state 48 (texas) shows
  var states = topojson.feature(us, us.objects.states),
  state = states.features.filter(function(d) { return d.id === 48; })[0];

    //define the features for the counties and filter based on number (starting with 48)
  var counties = topojson.feature(us, us.objects.counties),
  mycounties = counties.features.filter(function(d) { if(d.id >= 48000 && d.id <=49000) return d.id; });

    //initiate the class for the state, and add an outline path
  svg.append("path")
      .datum(state)
      .attr("class", "outline")
      .attr("d", path);

    //initiate the g object for the counties
  svg.append("g")
      .attr("class", "counties")
    .selectAll("path")
    //.datum(topojson.mesh(us, us.objects.counties, function(a, b) { return a !== b; }))
    // ^I tried adding this to replace the following line, but it does not work
    .data(mycounties)
    .enter().append("path")
      .attr("fill", function(d) { return color(d.establishments = centralTexas.get(d.id)); })
      .attr("d", path)
    .append("title")
      .text(function(d) { var obj2 = jsonCounties[d.id]; if (typeof obj2 != "undefined") {return obj2.countyName + ": " + d.establishments + " Active Establishments";} });

}

¿Cómo debería ir sobre esto? ¿Es posible hacer una consulta de filtro más complicada dentro de la función .mesh y eliminar totalmente la necesidad de mi

var counties = topojson.feature (us, us.objects.counties), mycounties = counties.features.filter (function (d) {if (d.id> = 48000 && d.id <= 49000) return d.id; });

¿código?

¿O necesito ejecutar la función de malla en esa variable con una sintaxis diferente?

Respuestas a la pregunta(1)

Su respuesta a la pregunta