Logo preload
close Logo

Options for Routing to Fulcrum Records

October 28, 2019

We’re just getting home from our attendance of the 2019 NetHope Global Summit where we had a fantastic time networking with folks who operate in the humanitarian, disaster response, and development sectors. There as technology partners, it was our first time to the event and we were excited to share with others how Fulcrum has become an integral tool in NetHope’s disaster response training & operations.

One topic that came up in discussions of our tools’ use in NetHope deployments was routing to a Fulcrum record’s coordinates. Fulcrum has the ability to use other mobile applications on one’s device to calculate a route from the users location to the record. As the discussion carried on, it was mentioned how that approach was only useful with internet connectivity. Being without connectivity can be a common scenario for NetHope field crews, especially early in their field operations, such as during the first 2 weeks after Hurricane Dorian. It was then that we thought about the great tool MAPS.ME, which allows you to download OpenStreetMap (OSM) data to your device and provides offline routing functionality.

How it works

We researched a bit and found that Maps.me has URL Actions available which can be accessed from Fulcrum – providing routing via OSM data. Utilizing Fulcrum Data Events, here are the results:

In a nutshell, here’s what’s going on:

  • When the Routing Options Yes/No field changes
  • If the Google Maps button/option was chosen – use OPENURL to open the Google Maps app at the coordinates of the record. It should then offer you the Directions button which would navigate you from your current location, to the record location.
  • Use SETVALUE to set Routing Options to null and clear the choice.
  • If the MAPS.ME button/option was chosen – use CURRENTLOCATION to store your current latitude/longitude values.
  • If we have values for the record’s location and our current location, use OPENURL – passing in all four coordinates into the URL scheme that Maps.me expects – to open the Maps.me app to provide a route.
  • Use SETVALUE to set Routing Options to null and clear the choice.

Notes: you’ll want to make sure to have either the Google Maps or Maps.me apps installed on your device ahead of time. In the case of Maps.me, you will have to download the data for your area. Also, Google Maps does offer the ability to download areas and navigate offline. You may want to consider all of the available options before going out into the field.

The last example in the above video demonstrates how Fulcrum leverages the native navigation functionality that is built into the Maps (iOS) and Google (Android) apps to provide users with driving directions to a record’s location. This is something that’s been in the app for a while, but which you may have forgotten or never known about. More about it on our help article here.

Here’s the Data Events code below if you’d like to give it a try for yourself!

ON(‘change’, ‘routing_options’, () => {

 if ($routing_options == ‘google’) {

   if (LATITUDE() && LONGITUDE()) {

     OPENURL(‘https://maps.google.com/?q=’ + LATITUDE() + ‘,’ + LONGITUDE());

   } else {

     ALERT(‘No location provided!’, ‘A location is required to show Google Maps.’)

   }

   SETVALUE(‘routing_options’, null);

 } else if ($routing_options == ‘mapsme’) {

   let location = CURRENTLOCATION();

   if (!location) {

   // location could not be determined.

   } else {

     lat = location.latitude;

     lng = location.longitude;

     if (LATITUDE() && LONGITUDE() && lat && lng) {

       // example maps.me URL scheme/intent

       // mapsme://route?sll=55.7522,37.6155&saddr=Destination&dll=55.763,37.6155&daddr=Destionation&type=pedestrian        

OPENURL(‘mapsme://route?sll=’ + lat + ‘,’ + lng + ‘&saddr=Start&dll=’ + LATITUDE() + ‘,’ + LONGITUDE() + ‘&daddr=Destination&type=vehicle’);

     } else {

       ALERT(‘No location provided!’, ‘A location is required to show MAPS.ME.’)

     }

     SETVALUE(‘routing_options’, null);

   }

 }

});

view rawfulcrum-routing-data-event.js hosted with ❤ by GitHub