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

481
Vistas
styling text at the end of polyline path (leaflet)

i create routing webgis that show multiply route from nearest facility function and
i want to show the distance route using with markinacorpus/Leaflet.TextPathplugin , but it's overlapping in the begining of route

enter image description here

i think it's better to place the text at the end of path. but idont know how to make it here is the code for my styling:

function addDistanceText(Feature, layer) {
            layer.setText(Feature.properties.distance_route + 'km', {offset: 17 });
            }

here is geojson data:

{"type":"FeatureCollection","features":[
{"type":"Feature","geometry":{"type":"MultiLineString","coordinates":[[[110.2382587,-7.9579805],[110.2380463,-7.9581418]]]},"properties":{"distance":"3989.57671272009"}},
{"type":"Feature","geometry":{"type":"MultiLineString","coordinates":[[[110.2374145,-7.9593029],[110.2371966,-7.9598229]]]},"properties":{"distance":"2206.76527447351"}},
{"type":"Feature","geometry":{"type":"MultiLineString","coordinates":[[[110.2374145,-7.9593029],[110.2379765,-7.9594952]]]},"properties":{"distance":"2667.74036482918"}}]}

any body know how to style text path without overlapping?

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

0

as IvanSanchez and enxaneta recomended, i reverse the geojson array (spesificlly the order of feature)
here is the code:

result.features.forEach((feature) => {
   feature.geometry.coordinates.reverse().forEach(_reversecoordinate);
   function _reversecoordinate(item) {
      item.reverse();}
   });
over 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
Asistente virtual