Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

248
Visualizações
How can you combine GeoJson features by their property value?

TLDR: Can you join together GeoJSON features that have a common property, such that the final polygon is a combination of the smaller features?

I'm building a web application that requires me to modify some existing GeoJSON by removing lines between counties, essentially creating larger polygons out of smaller ones. Here's what the GeoJSON looks like:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [[[[ ..some coordinates ]]]],
      },
      "properties": {
        "joiner": 1,
        "PUMA": "Alameda County"
      }
    },
    {
      "type": "feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [[[[ ..some coordinates ]]]],
      },
      "properties": {
        "joiner": 2,
        "PUMA": "San Jose County"
      }
    },
    {
      "type": "feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [[[[ ..some coordinates ]]]],
      },
      "properties": {
        "joiner": 1,
        "PUMA": "Fremont West"
      }
    },
  ]
}

In this dummy example, I'd like to join together Alameda County and Fremont West, because they both contain the "joiner" property of 1 (they are next to each other, this is a given). Visually speaking, this would mean that certain adjacent polygons on the map would be joined into a single polygon.

This is what the data currently looks like when projected using MapboxGL:

Original GeoJSON

The final projection would join together adjacent polygons with a common property and remove the dividing lines, creating larger ones:

Joined GeoJSON

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use Turf's "dissolve" method, which does exactly this:

var dissolved = turf.dissolve(features, {propertyName: 'joiner'});

Documentation: http://turfjs.org/docs/#dissolve

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda