ArcGIS Survey123

Barcode Scanning in ArcGIS Survey123

[Source: Survey123 for ArcGIS Blog in GeoNet]

A barcode is an optical machine-readable representation of data. A lot of things around us have barcodes. You will find them in virtually any packaged item you buy, in the back cover of books and most likely somewhere in your laptop, its power adapter, or the PC/Mac you may be using right now.

Typically, barcodes are attached to things using a sticker, or simply printed on them. You can put any data you may want in a barcode, but generally they are used to unequivocally identify the item. Barcodes are designed to encode data in a way that can quickly be scanned using either a barcode scanner, or through the camera of your smartphone.

A typical use of barcodes with Survey123 is that where an asset, like a pole, meter, pipe etc has a barcode in it; field users with Survey123 scan this barcode to quickly bring the unique identifier and other asset information into the form. In this way, room for error when capturing the unique identifier of the asset is removed, not to mention that capturing the data is very quick.

The Survey123 field app can interpret barcodes though your device’s camera, so you do not need external barcode hardware to work with them.

In this photo, you can see a field user leveraging Survey123 barcode scanning capabilities to support sign inspections. If you look close enough, you will be able to see that the pole and the sign have both a sticker with a barcode. The barcodes include information about the unique ID of the asset, ensuring data integrity and simplifying the completion of the Survey. Many thanks to Gary Bowles, GIS Database Administrator at Seneca Resources Corporation for the photo.

Survey123 barcode scanning
Field inspector using Survey123 to scan an asset barcode. Photo courtesy of Seneca Resources Corporation

Types of barcodes

There are multiple flavors of barcodes, which we can organize into two categories: linear and 2D (matrix) barcodes.

The original barcodes where all linear. They were invented in the 1960’s, popularized in the 1970’s and still the most commonly used today. Here is a linear barcode representing the value 036000291452.

Two-dimensional barcodes can encode more information. A popular one these days is the QR code, which you may have already used from your smartphone, may be to quickly access a web site, or to download a mobile app.

There are lots of different types of barcodes, even for each of these two categories. Choosing one type or the other will depend on what type of data you want to encode (not all types support international characters for example), the size of the data, the amount of space you have for the sticker, etc

Another important aspect before choosing the barcode type to use is licensing. Many barcode styles are patented and you could not use them to print your own data. You can learn more about the different types of barcodes in Wikipedia. From a practical perspective, if you would like to create your own barcodes, a safe bet is to go with a 2D style, as it will give you good flexibility to store data of different sorts. And one that is in the public domain, such as Aztec or QR Code.

There are different ways to create barcodes. To start playing around a bit, I personally liked qr-code-generator.com , canva.com and also barcode-generator.org. You will also find API’s, to create these barcodes programmatically, as well as solutions of all sorts to print stickers: in bulk, from a pocket printer, to print waterproof barcodes etc There is really a world around barcodes. If you are hardcore enough you will even find people who will tattoo them on you.

Barcodes in Survey123 (The Basics)

If you want field users to be able to scan a barcode and get the data added to your survey, you need to add a barcode type of question in your XLSForm. Barcode questions, by default, are shown in your form as an input box -where the user can manually enter data- plus a barcode scanner button, which will trigger the device camera. By simply focusing on the barcode, and tapping on the camera, the barcode will be scanned and the data from it added to the input box of the question.

By now, you know that there are many types of barcodes. Survey123  supports a very specific subset of them: QR Code, Code 39, Code 93, Code 128, EAN 8, EAN 13, UPC A, UPC E, UPC EAN Extension, Aztec, Codabar, Data Matrix, ITF, MaxiCode, PDF 417, RSS14 and RSS Expanded. If scanning fails, the first thing to check is if Survey123 is configured to scan the type of barcode you are targeting. Use the menu button in the top-right corner to configure the scanner. You can configure the barcode scanner to scan any of the supported types if you like.

A Barcode Scanning survey sample has been added to Survey123 Connect , so you can get started.

  1. Open Survey123 Connect, click on New Survey
  2. Search for the Barcodes sample survey in the Samples category
  3. Publish and download it into your own tablet or smartphone.

You can exercise the sample  survey scanning barcodes around you.

Parsing and manipulating barcode data right from the Survey123 field app

Barcode questions in Survey123 support the minimal appearance. When used, the barcode question will not show any type of input text box. Instead, all the user will see will be the name of the question, as well as the button to start the scanner. The minimal appearance in a barcode question is typically used in combination with calculations in other questions: the barcode question is used to fetch data, and the calculations extract that data and display it to the user.

Say for example you want to use a barcode to store the Unique Identifier of an asset and the company that produced it. We would not want to show all that information in a single field, because it would be confusing to the field user, and somewhat useless stored that way. So we hide the raw data obtained from the barcode (minimal appearance), and then we use calculations to split that content into two separate questions… like in the following example:

This idea of using barcodes to persist an array of values at fixed lengths is very common. Using the substr function in calculations makes it relatively easy to auto-complete one or many questions in your Survey. You can also use custom JavaScript functions in your survey to parse more complex data structures.

About the author

Ismael Chivite joined Esri in 2002. A geographer by training, he loves helping people leverage GIS to improve the way they work. As a Senior Product Manager, Ismael is always looking for ideas to create new and improve existing Esri products. Outside working hours: Legos, rock climbing, Romanesque architecture and jamon iberico. On occasion, he enjoys jamon during working hours too.

Connect:
0 Comments
Inline Feedbacks
View all comments

Next Article

Supercharge your stories with media actions

Read this article