Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Trying to Bind Tooltip to Result of Turf Distance Method

I'm trying to simply put the results of the distance variable in the tooltip but keep getting undefined. I don't understand what's happening. I know it's something simple. Thanks!

                
                // convert Leaflet layer to geojson with Leaflet toGeoJSON() method
                var centCounty = countyPolygon.toGeoJSON();

                // get centroid of county polygon
                var centroid = turf.centerOfMass(centCounty);

                // create marker from centroid
                var lon = centroid.geometry.coordinates[0];
                var lat = centroid.geometry.coordinates[1];
                
                var marker = L.marker([lat, lon]).addTo(map).bindTooltip(`${distance} Miles`).openTooltip();

                var distanceGeoJSON = marker.toGeoJSON();

                var from = searchedFeature
                var to = distanceGeoJSON
                var options = {units: 'miles'};

                var distance = turf.distance(from, to, options);
                console.log(distance)
  
            }
        }```
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!