I’ve been getting interested recently in QR codes – having seen them becoming more prominent in daily life – and wondered if there were any useful applications for them using FME. As always, there are a ton of things we can do with this technology – but whether they are useful applications I’ll let you decide!
What are QR Codes?
In case you are wondering what I am talking about, QR codes are a form of two-dimensional barcode. They look something like this:
I believe the original idea was to code components in a car manufacturing plant, but they can be used to encode any type of information, and with a larger capacity than a regular barcode. Of course, this was of little use to most people, who rarely carried a QR barcode scanner around with them, until….. smartphones!
Now that most people do carry a tool that can read a QR code, their use is taking off in everyday life. They can be used to transmit web page URLs, email addresses, phone numbers, SMS messages, calendar events, business cards (vcards – like the one above), plain text, and more.
So, is there a geographic/FME use for them?
FME Server URLs as a QR Code
If you know FME Server then you’ll know that it is really just (just!) a way to run a workspace online and stream results back to you. Since it relies on URLs to carry this out, it’s not difficult to encode an FME Server URL into a QR code.
Browsing to an FME Server repository, I can select a workspace and see the URL/request to call it is as simple as:
So now I can visit any number of online QR code generators (there’s a list at the foot of the page), enter the URL, and get a code back:
If you have a smartphone with a QR Code reader, then give it a try. The above code will run an FME Server streaming workspace and return a JPEG file showing the Netherlands and part of Scandinavia. Your phone should open it automatically.
OK, that’s all good. So now, whenever I put out a map, document, poster, etc from which it would be useful to link to this data, I can just add the QR code image. For example, a real estate agent could add it to their brochure for a property, and people could thereby access a FME Server-generated map directly from their smartphone.
Of course the benefit of FME Server – over another method – is that it’s all dynamic. The data being retrieved and served could change over time, or you could even deliver different results every time!
For example, in a political campaign I have a whole bunch of election signs to which I can add a QR code (the same for all).
During the campaign the code can redirect people to the campaign web site. However, after the campaign we switch the link to redirect to an FME Server workspace.
When one of my team of helpers takes a sign down, they scan the QR code and FME delivers a map of the nearest election sign still to be removed. BUT – and here’s the clever part – it tags that sign in the database so that if a helper elsewhere scans the code, they will not get the same sign.
So I can have a team of people removing signs and being directed to the next – without overlaps or clashes – until all signs have been tagged as removed.
OK, so the previous example used JPEG. Now let’s try an FME Server masquerading as a WMS:
Again, it works for me. This image is larger simply because there is more data to encode (a longer URL). Now let’s go for yet another format and try streaming a PDF:
Yes, that one works for me too – how about you?
To cut a long story short, I can quite easily get FME Server to send raster information straight to my phone when prompted via a QR reader. Where I was disappointed was in not being able to get any sort of streamed vector data back – for example an XML feed, KML dataset, GeoRSS, GeoJSON, etc.
I’m thinking this might be more a problem with either my phone’s compatibility, or the QR reader; maybe you can try to see if it works for you? Or is there a GIS app for a smartphone that could have data streamed to it?
GEO Tags on QR Codes
OK, so a URL returning data from FME Server is one example. Are there any more? Well, yes. One other form of QR code involves a GEO tag. Instead of a URL, you use the format GEO:<lat>,<long>
Most online QR code generators have the option to generate a GEO tag, but to incorporate this into FME the most useful concept would be to have FME turn spatial features into a lat/long and create a QR code from that.
What helps here is that the Google Chart API now includes an option for QR code generation.
You might be aware – but probably not – that FME already has a transformer to access Google Charts: the WebCharter. It doesn’t yet support the QR code option, but that doesn’t really matter as we can do the same thing with a HTTPFetcher.
Here’s a workspace I came up with (click to enlarge):
The sequence of actions is:
- Read a set of park features (polygons)
- Replace the polygon with a point at its geographic center
- Reproject the data to LL (from TX83-CF)
- Extract the X/Y coordinates to attributes
- Create a HTTP string to call the Google API
- Create a string for fanning out the output data
- Call the Google API and fetch the QR code into an attribute
- Extract the attribute contents as a true raster feature
- Write the output to a series of PNG files
What I get from this is a set of QR codes, for example Batholomew.png:
I fire up the QR Reader on my iPhone (yes, that’s right, I don’t check messages that often):
Read the FME-created QR code:
…and the map opens right up at the expected spot:
Of course, I’m using the GEO tag there, but there’s nothing to stop you adding different information to features you’ve read with FME; for example I could have created a QR code with a link to a URL for each park, or I could have merged in some attribute data and added that as the content.
And then perhaps I might want to embed them into a map, like this:
Whether it’s a good idea or not, we’re seeing a few more folk use FME to directly create cartographic products. There was a fantastic example from Spain we saw that created an output in PDF. When you’re doing that, perhaps there is a place for embedding FME-generated QR codes too?
Other FME-Generated QR Codes
So then I got wondering if there’s any other use for FME-generated QR codes?
I guess you could extract the full geometry of a feature (GeometryExtractor) and wrap that up, though it makes for a fairly large code, and you’d need the reader customized to understand what OGC WKT (for example) is meant to be:
But I’m not sure really where this could go. The one other thing I found was that a QR code that directs you to google.com/gmm from a smartphone returns a map centred on my location – but while nice it’s not FME related unless I can add extra data around it, and I couldn’t manage that. I’ll leave that idea to other inquiring minds.
As always, there are some interesting things you can do with FME and a bit of imagination. If you do come up with anything interesting on the subject – and I know some folk have – then please do send me an email and share what you find.
As promised, some sites to create QR Codes are:
Mark IrelandMark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)