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

327
Vistas
Using PolyLabel with GeoJSON data and Google Maps

I am attempting to use the PolyLabel library with GeoJSON data and the Google Maps API to generate appropriately placed labels for irregular polygons. The documentation says that the library accepts polygon coordinates in GeoJSON-like format.

The problem is that I cannot figure out what data to pass from the Google Maps API data layer to PolyLabel to get the best fit label position.

polygons.forEach(function (feature) {
    var geo = feature.getGeometry();

    var position = polylabel(???, 1.0);

    var mapLabel = new MapLabel({
        position: position,
        text: feature.getProperty("LABEL"),
        fontSize: 25,
        fontColor: "red",
        map: map
    })

    currentLabels.push(mapLabel);
});

I have tried multiple variations on passing in the feature, the geometry, the raw coordinates, and constructing polygons from the coordinates.

It is also worth noting that the GeoJSON data contains a mixture of Polygons and MultiPolygons.

Thank you.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

definitely difficult to see, but you can find it here. https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/polylabel/index.d.ts

for each point in the polygon, you have [x, y]. Each polygon is then [[x,y]...], and polylabel takes array of polygons.

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