Park Finder / Place Finder - Distances wrong when search by Name or Activity

3084
2
01-13-2014 10:54 AM
Labels (1)
LuciHawkins
Occasional Contributor III
Hello,

I have downloaded both Park Finder 10.2 and Place Finder 10.2 from GitHub. Both produce the same error when a search is performed using "Name" or "Activity". In the "Search Results" div, they both return for example: Park Name(6,544.29 miles approx) In the "Directions" div, they both have Total distance: 5.54 miles(s) Where is it coming up with that figure next to the park name in the "Search Results" div? The distance is correct when you search by "Location".

I noticed that the example at http://tryitlive.arcgis.com/ParksFinder/ has removed the distance in question from that div when a search by Name or Activity is used. Was that due to this same bug? Anyone with any insight?

[ATTACH=CONFIG]30469[/ATTACH]


Thanks in advance!

Luci
0 Kudos
2 Replies
RickeyFight
MVP Regular Contributor

Luci,

I finally figured this out!! I was having the same issue. If you open the locator.js file, then go to line 436

td.className = "selectedPark";

        if (featureSet.distance) {

            td.innerHTML = featureSet.name + " (" + dojo.number.format(featureSet.distance.toFixed(2)) + " miles)";

        } else {

            td.innerHTML = featureSet.name;

        }

Remove the + " (" + dojo.number.format(featureSet.distance.toFixed(2)) + " miles)"

Should look like this:

td.className = "selectedPark";

        if (featureSet.distance) {

            td.innerHTML = featureSet.name ;

        } else {

            td.innerHTML = featureSet.name;

        }

I hope this helps.

If I figure out to change the location to display the correct miles I will post it on this discussion.

TONIFAIRBANKS
New Contributor III

Here's another example.

Modification example for Park Finder 2.0 locator.js file.

tdFeatureList.className = "selectedFeature";

        if (featureSet.distance) {

            if (approximateValue) {

                //If the approximateValue is set in the config.js file, the approximate distance value will show in the Search Results box.  I commented out the configuration value.

                tdFeatureList.innerHTML = featureSet.name + " (" + dojo.number.format(featureSet.distance.toFixed(2)) + " miles " + approximateValue + ")";

            } else {

                //I removed the approximate value, which I assume is as a crow flies.  It is confusing when drive directions are provided.

                //tdFeatureList.innerHTML = featureSet.name + " (" + dojo.number.format(featureSet.distance.toFixed(2)) + " miles)";

                tdFeatureList.innerHTML = featureSet.name;

            }

        } else {

            tdFeatureList.innerHTML = featureSet.name;

        }

0 Kudos