This blog introduces Trek2There, a new mobile app from Esri Labs just published to the Google Play and iTunes app stores. You can think of this app as a smart compass that will always point to your destination. Unlike an ordinary compass, always pointing to magnetic North, this app will use your direction of travel to tell you in what direction you should go to reach your destination. Best of all: you can integrate this app with Survey123!
Esri Labs projects are developed by Esri employees and are inspired by our interactions with ArcGIS users like you. Esri Labs projects are free to use but are not official Esri products. These projects do not go through the rigorous software development cycle so they are not holistically tested, documented or supported by Esri technical support.
Trek2There is particularly helpful when you are trying to find a location in an area where you cannot get driving directions. If you are working for example in a forest, or in a large agricultural property with not even dirt roads, using straight-line-navigation is often the most practical approach to arrive to a known location.
Trek2There only requires two things to work:
- First, the destination where you want to go provided in geographic coordinates (Latitude/Longitude).
- Second, it requires you to be outside and moving so your device can fix your location and determine your direction of travel.
Let’s first try the app and then I will explain details of how to make it work with Survey123.
Trek2There, a quick first test
Start by downloading Trek2There onto your Android or iOS device. First, you need to feed the app with the coordinates of your destination, which can you can enter manually or alternatively pass from a separate application. For now, we will use a simple web-based app to pass the coordinates. On your device, launch this web app and tap on the map to select your destination. Next you will see a new dialog open from which you can launch Trek2There.
Now that the app is running, start walking in any direction and shortly the arrow will rotate to show you the direction and distance to your destination. Walking with caution and avoiding physical obstacles is all on you!
Trek2There custom URL scheme
Using the app is straight-forward as you can see. Launching it and passing the coordinates of your destination is what takes some thought but do not worry, it is not complicated at all. Trek2There can be launched remotely by invoking its custom URL scheme:
If you copy the above string and paste it into a browser on your device, you will be able to launch Trek2There and set its destination at the provided latitude and longitude. You could send this URL as a link in an email, or programmatically invoke this URL from a custom developed application.
Launching native apps like Trek2There through a custom URL scheme -also often referred to as a deep-link- works fairly well across all platforms when you invoke the URL from a custom native application. If you invoke the app from a web browser it will work as expected on Windows, iOS and Mac. On Android you may find issues launching the URL scheme from some mail clients and in the Chrome browser.
Working with Trek2There and Survey123 for ArcGIS
Invoking Trek2There programmatically
In a web app or website, simply create an HTML link:
<a href='arcgis-trek2there://?stop=38.133453,-117.223455'>Launch Trek2There</a>
In QML AppStudio for ArcGIS:
In Java, using Android's Intent:
PackageManager manager = mContext.getPackageManager();
Intent i = manager.getLaunchIntentForPackage("com.esri.survey123");
Customizing and Contributing to Trek2There
The source code of Trek2There is shared under the Apache 2.0 License, so if you like you can take this app and make it your own. Perhaps you may want to embed this functionality within your own app, or re-brand Trek2There… your choice! You can find the source code at https://github.com/Esri/Trek2There. Esri welcomes contributions from anyone and everyone. If something is not working for you, create an issue... if you actually know how to fix existing problems or want to contribute, please follow these contributor guidelines.
The easiest way to download the source code is by using AppStudio for ArcGIS Desktop Edition. Once installed, click on New App and search for Trek2There under the Enterprise category. You can look at the code, modify it and run it in your Mac or Windows development machine. If you have an AppStudio for ArcGIS Standard license, then you will be able to compile your code for Windows, Mac, iOS, Android and Ubuntu Linux. The AppStudio for ArcGIS GeoNet Group is quite active. A great place to address technical questions.
You see, even if Trek2There is not an app you ever use, if may be worth looking into its source code to get familiar with AppStudio. After all, just like Trek2There, the source code of the Survey123 field app is also available with AppStudio for ArcGIS. Can you imagine adding your own features into Survey123? Hmmm, that may be a good idea for a separate blog post.