• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

159
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?

almost 3 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();}
   });
almost 3 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 Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda