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

359
Visualizações
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?

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

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();}
   });
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