How we forward geocoded addresses using the PB Location Intelligence API

Posted by: Tom Linton

Requirement:

We were asked by Pitney Bowes to provide Yellowfin customers with the ability to forward geocode addresses using the Pitney Bowes (PB) Location Intelligence API.

How We Did It:

Step 1: Sign Up

I visited this link to sign up for a free trial of the Pitney Bowes API.

Step 2: Learn How to Use Pitney Bowes API

I visited this link to see an example of how the API was called in a REST implementation. Luckily for me, Pitney Bowes had an example written in Java.

Step 3: Get the Example to Work Outside of Yellowfin

I took the sample code from the link above and worked on getting it to work outside of Yellowfin. The challenge here seemed to be the substantial number of libraries that were used in the example. After a few days of searching the libraries and getting all the right versions, I was able to make the Pitney Bowes example code work for forward geocoding.

Step 4: Integrate into Yellowfin

When creating my project to integrate into Yellowfin, I was given sample code of a very basic example of a Yellowfin transform widget. After looking at the code, I could see that processWireData() would allow me to get the data out of Yellowfin and perform the call to the PB API. The problem here was that processWireData() is a function that processes one row at a time. This would not be efficient when dealing with an API that handles bulk transactions. After consulting with a developer, I found that processEndRows() would be a better function. It would allow me to grab all the data and then call the API before passing all the data back.

I took the code that I had got working outside of Yellowfin and worked it into the processEndRows() function. Once worked in, I needed to create a section on the config panel for the transformation step that told my code which field was which when building the request string.

Step 5: Upload and Test

Once the code was written, I uploaded my widget to Yellowfin via the plugin manager to test. After some minor tweaking, it worked! Below are two pictures of the final step. The first image shows the standard input where it can take a single field that contains a complete address. The second is the advanced input where it can accept an address broken out.