Current Location

Alrightโ€ฆ This is about showing the current location on the map.
Iโ€™ve been trying to solve this for a few days now in a replicated prototype of my live version.
I have a data table that feeds into a slice.
This slice is the data set for the map view.
There is currently one location column, โ€œlocation,โ€ that shows all of the pins on the map that match the condition of the slice.

So, normally, about 20 different pins show on the map.
Additionally, a โ€œView Map (Location)โ€ button that shows up on the map, on the bottom right.
When this button is clicked, a bouncing red pin shows that, when moved, feeds into a form, that will eventually populate more pins.

When this button is clicked inline, it shows the current pinโ€™s zoomed location on the map.
This โ€œView Map (Location)โ€ button on the map only shows if the data set is editable and if the main source of the map view is โ€œLocation.โ€
This button is necessary.

Now, the staff has suggested creating a virtual column with the โ€œHere()โ€ formula and use this instead of the โ€œLocationโ€ column for the map view.

There are several issues.

  1. If the โ€œLocationโ€ column is replaced with โ€œHere()โ€ virtual column, the โ€œView Map (Location)โ€ system-generated action disappears. This action cannot be replicated. Even if I create the exact copy, it does not appear on the map the same way as it did before.

  2. If the โ€œHere()โ€ virtual column is toggled to show, the current pins are repopulated as plain green pins in a close cluster. The pins are not in their designated locations and it looks very wrong.

  3. If the โ€œHere()โ€ virtual column is toggled to not-show, the weird green pins donโ€™t show, but none of the other pins from โ€œLocationโ€ show either.

  4. If โ€œHere()โ€ is the main column and โ€œLocationโ€ is the secondary column, the โ€œView Map (Location)โ€ action is still not shown, the map is zoomed out just like it was when it was only โ€œLocationโ€ as the main column, and the purpose of โ€œHere()โ€ virtual column is pointless.

  5. Same if โ€œLocationโ€ is the main column and โ€œHere()โ€ virtual column is secondary, just the โ€œView Map (Location)โ€ action is viewable, but the start view of the map is STILL not the userโ€™s current location.

  6. If there is no โ€œHere()โ€ virtual column, the initial value of โ€œHere()โ€ for the โ€œLocationโ€ column doesnโ€™t affect anything. The map still begins showing all the pins on the map instead of the userโ€™s current location.

  7. If the app formula for the โ€œLocationโ€ column is edited in ANY way, the โ€œView Map (Location)โ€ action disappears.

โ€ฆ
Iโ€™ve tried many, many things.
Here is my suggested solutionโ€ฆ

  1. Please stop giving advice to add a virtual column with the โ€œHere()โ€ formula, it only works if there are no other pins on the map.

  2. Currently, the โ€œAddโ€ and โ€œView Map (Location)โ€ actions, system-generated, seem to be the only ones that are allowed to show on the bottom right of the map view. We should have the option to add our own actions to this place as well.

  3. The action I suggest is some sort of LINKTOVIEW or CONCATENATE button that people can click (inline, prominent, overlay, and map bottom right) that will take a person to their current location.
    When completing a form, in the location input, thereโ€™s a bouncing red pin and in the upper-right of the small map box, thereโ€™s a small map pinโ€ฆ This map pin, when clicked, takes a person directly to their current locationโ€ฆ Why canโ€™t this type of button be recreated anywhere else in the app?

  4. The DEFAULT view of a map view should NOT be the view of all the pins. This means that if pins exist in Africa and Japan, the CURRENT default view shows both Japan and Africa at once. This is very annoying for people who only care about dropping a pin in their current location (20~50km) map range.

Itโ€™s either a new required & necessary feature or somehow use the current formulas to link directly to a personโ€™s current view. I know a feature might take a few days or so to roll out, but in the meantime, would really appreciate the correct formula to link

Actions should be allowed to be shown in the navigation bar or menu as well.
So we can have the option of replacing the map view in the navigation bar and replacing it with an action that leads to a map view starting at the userโ€™s current location.

This is such a complicated issue, but I really hope to receive a solution soon.
Thank you.

2 9 2,726
9 REPLIES 9

Alright, Iโ€™ve created a viable & smooth solution with what we have now.
Based on the principles of geofencing.
Whatโ€™s needed:
ใƒปAbility to change USERSETTINGS() in the Data category, User Settings is right of the Slices tab.

  1. Create a virtual column called โ€œNEARBYโ€ or whatever you want to call it, the formula will be ROUND(DISTANCE(HERE(), [Location])), type โ€œNumberโ€ โ€ฆ [Location] is the name of my LatLong column that feeds into my map view.
  2. Go to User Settings and toggle Options Heading to show, then edit the name of the next option to โ€œDISTANCEโ€ or whatever you want, make it Enum, Number type, and add some optionsโ€ฆ 20, 50, 100, 1000, 5000โ€ฆ Or whatever you want.
  3. Go to your slice, if itโ€™s already [some column] = โ€œthis valueโ€ just change it to AND([some column] = โ€œthis valueโ€, [NEARBY] < USERSETTINGS(DISTANCE)) โ€ฆ IGNORE THE ERROR
  4. Save & Verify.
  5. Go to the UX category, go to the Options tab, under General, select User Settings as the starting view.
  6. Go to the UX category, go to Views tab, you will see the Settings view, change the finish view to your map view.

Remember, your slice needs to feed into your map view.
20km radius from the userโ€™s current location is close enough a solution to the HERE() problem I mentioned above.

More filters can be created & selected from the User Settings and placed into the Slice.
For my app, I localize the language according to the user, which adds another level of complication.
In the future, I plan to add several other languages so this app can become global.
Thank you for providing such an easy to use and editable platform for us and my NPO.

This is a really useful trick that I hope the staff can pin when you replicate & verify it.
@Adam please take a look!

This is a good solution and beats trying to geofence using 4 coordinates. However, I have a little bit of a wrinkle/challenge I would like to throw out there.
If I have a table full of locations with latlong (and Iโ€™m talking 200,000 locations), how can I identify which location is closest using HERE(). Essentially I want to confirm that the USER is nearby a location (or inside) when they submit the form. Or even preselect a small list of locations using HERE() from the larger list.

The process would goโ€ฆ

  1. user enters a location
  2. opens app & form
  3. enters data
  4. submits form
  5. report shows the user was closest to โ€œXโ€ location from the list when submitting the form

Thoughts?

One way could be to add 4 columns for each location - LatNearMin, LatNearMax, LongNearMin and LongNearMax and filter location based on lat and long of HERE().

You could try:

TOP(
  ORDERBY(
    locations-table[key-column],
    DISTANCE([latlong-column], HERE()),
      FALSE
  ),
  5
)
  1. Replace locations-table with the name of the โ€œtable full of locationsโ€; key-column with the name of the key column of that table; and latlong-column with the name of the column in that table with the locationsโ€™ LatLong values.

  2. DISTANCE([latlong-column], HERE()) computes the distance between the userโ€™s current location (HERE()) and the location described by a given row.

  3. ORDERBY(locations-table[key-column], ...) orders the rows of the locations table by distance from here (per (2)) in ascending (closest to furthest) order (per FALSE).

  4. TOP(..., 5) gives the first 5 rows from the list generated by (3), which should be the 5 closest.

See also:



This describes DISTANCE():

This is gonna take some time for 200000 locations but hopefully not too prohibitive.

Manโ€ฆ 200,000 rows. The table better be sparse - likeโ€ฆ only the lat and long, maybe an ID. 200k rows is a lot for a mobile device, or even a PC, to handle. Hosting this on a SQL will help; any cloud-based spreadsheet will run REEEEAAAAALLLLLYYY slow.

Iโ€™ve found that 30k records is the trouble point for Google sheets;

  • your app will be lightning fast under 10k records;
  • 10k - 20k and things start to slow in certain areas, which you can usually refine and smooth out these choke-points;
  • but when you get to 20k things really start to bog; youโ€™ve got to get smart on what youโ€™re calculating, how youโ€™re calculating it, etc.
  • 30k+ and you need to migrate to a SQL server; this helps bring things back down to the performance your users will remember around 15k-25k records (not that they would know this count), otherwise performance-lag will really start to show.

One of my long-time clients is a tele-health company; weโ€™ve been fighting the good-fight on data-bloat for the past two years. We collect data points like weights, med tracking, etc. and you can see how records would stack up quickly.

On one respect, you want all the data there for the best possible analysis; but on the other, you canโ€™t include everything because then the app wouldnโ€™t be workable. Weโ€™ve had to come up with informed data-schema updates, where we took into consideration HOW people were working with the app and made changes to how we were storing certain parts.


You might need to consider ways of splitting your location table into smaller ones (by state, region, etc.), then make use of the partitioning feature in Tables:

Thank you for the heads up on data bloat. You are absolutely right that this would bog down any machine. I can and will breakup the reference coordinates by state using the partitioning option. Thanks again for the reply. When/if I get it up and running Iโ€™ll circle back.

Hi Ricardo,

thanks for the proper advice and I tried Here() and what you said is perfectly correct. So I decided to try your way. Now I am stuck at step 3. I am confused with โ€œif itโ€™s already [some column] = โ€œthis valueโ€ just change it to AND([some column] = โ€œthis valueโ€, [NEARBY] < USERSETTINGS(DISTANCE)) โ€ฆ IGNORE THE ERRORโ€. I have recorded a video to show what I have done and not done. Please take a look and advice next.

Hi @Ricardo_Gonzalez Here is a workaround:

Top Labels in this Space