Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

244
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda