[ClosestMapMarkerCalculator] Please help with this Error - ClosestMapMarkerCalculator Mobile

[ClosestMapMarkerCalculator] Please help with this Error - ClosestMapMarkerCalculator Mobile

  
Forge Component
(4)
Published on 2 Jan by Cristiano Lúcio
4 votes
Published on 2 Jan by Cristiano Lúcio

Hi All,

This component seems straightforward enough but i'm going wrong somewhere. Here is what I currently have:

And this is the result I get on mobile:

Any advice on where I'm going wrong?

Thanks

Did you debug to see where the error originates? Is it at ClosestMapMarkerCalculator? If so, what is its input?

Kilian Hekhuis wrote:

Did you debug to see where the error originates? Is it at ClosestMapMarkerCalculator? If so, what is its input?

Hi Kilian,

The error was the long decimal. It was coming from the 'GetLocation' action. I rounded it up using 

Round(GetLocation.Location.Longitude,16)

and the error no longer comes up.

The problem I run into now is that no markers show up. I've appended the original marker list with the lat/longs from my aggregate, and input it into the calculator as requested but still no markers. Any ideas?

Thanks


Unfortunatly not, I've never used that specific Action. Have you tried to use any "known" coordinates instead of the ones from GetLocation?

Kilian Hekhuis wrote:

Unfortunatly not, I've never used that specific Action. Have you tried to use any "known" coordinates instead of the ones from GetLocation?

Yes, though none of it seems to be working for me (or i'm not doing it right rather). I'm trying to essentially show a cluster of markers around my location/set coordinates within a set radius. There must be another way as people have probably done this before this component, how would you go about it? I'm looking into the 'Haversine' formula and wondering how to implement that


Hello OZOZ,

If you turn on the debugger, are you getting the expected or any output data from the component ClosestMapMarkerCalculator?

From my experience using this component and from your description:

  • Or Something is going wrong in the calculation of the closest coordinates (may be related to the coordinates your sending to the component)
  • Or something is going wrong when trying to render the closest coordinates in google maps

Cheers

Cristiano Lúcio wrote:

Hello OZOZ,

If you turn on the debugger, are you getting the expected or any output data from the component ClosestMapMarkerCalculator?

From my experience using this component and from your description:

  • Or Something is going wrong in the calculation of the closest coordinates (may be related to the coordinates your sending to the component)
  • Or something is going wrong when trying to render the closest coordinates in google maps

Cheers


Hi Cristiano,

Sorry for the delay in reply, it's been a long day! 

So after going through the debugger, I found that the calculator was doing it's job and was outputting the correct number of records with the closest distances.

The whole error was on my part, I was forgetting to assign the results to the MapMarker list that was already on the map. For some reason this whole time my brain was telling me that it would map it automatically but it just now clicked thats what I should do! Now it works perfectly.


In regards to the first issue with the 16 digit decimals, i cannot be certain as i dont have a dev account to run the debugger through the app on my phone but i will test using the plain GetLocation coordinates and the rounded up version to see whether it is simply a case of the decimal being too long. Will post back here just in case anyone has the same issue in the future.

Solution

Update:

So I tested using the unfiltered GetLocation and it gavev me the original error of the decimal being too long. What I did is apply a filter to the lat/long values of the GetLocation action and assign it:

I applied the round up to both lat and long even though it was the long giving me an issue. Did this just in case in the future the problem happened to be the lat, just for safe measure. If it doesn't by default pass the 16 digit limit, it will not be applied.


Thanks to both of you for your help!

Solution

Great to hear you got it solved OZOZ, and thanks for the feedback.