Geospatial Features in MongoDB with Jaspersoft

Lately I have been posting technical examples to the Jaspersoft community wiki instead of this blog. I'll cross-post this one because there are not many examples of doing this. When working with Geospatial data, I found the $near operator to be pretty sweet. Let me show you by example.

In the screenshots below you'll see that I constructed a report that shows "cases" on a map. When you click on a specific case you will be taken to a detail level report. The detail level report will show you cases nearby for that service. So for example, if someone reports a broken street light on Market Street, this might help you locate similar cases.

So how is it done?
 Quite simple really, take a look at this mongodb query:

  • Line 8: The $P{location} parameter is a java.util.List that contains longitude and latitude coordinates, something like [-122.4194200,37.7749300]
  • Line 11: How many meters from the center (specified in line 8) should it search
  • Line 13: The $P{service} parameter is a string containing the name of the Service, in the screenshot above it's Missing Sign
  • You will need to have an index on your location field, like so: ensureIndex({"location" : "2dsphere" } )

  • That's it, I've never really done anything with geospatial data and this seemed like it was a piece of cake.



    New MongoDB Components in Talend/JaspersoftETL

    I uploaded two videos with examples of using the tMongoDBInput and tMongoDBRow components that are shipping with JaspersoftETL 5.2.2 (Plus edition) and Talend 5.2.2+

    I recommend you change the quality to 720p to watch the videos in better quality. I hope you find them useful!

    Part 1: Using tMongoDBInput (and using Talend's built in aggregation engine):

    Part 2: Using tMongoDBRow (and the aggregation framework):



    Report Bursting in JasperReports Server

    What is report bursting?

    Take this example. You have a report that shows all the accounts that a particular employee owns in your company. The user can log into your reporting system and ask for the report, he'll be asked to enter his employee ID or maybe it will be filled in automatically based on who he/she is.

    Now your boss asks you (a BI professional) to send each employee their list of accounts on a weekly basis...yikes! You need to automate this. What do you do?

    As of Jaspersoft version 5.0 there's no UI built into the web-application to handle the complex task of report bursting. Designing an UI that let's you iterate through any possibility of inputs, read any possibility of values and output to any possible medium is tricky, for now you have to build your own utilities using the rich SOAP or REST APIs that are available in JasperReports Server. The easiest way I found to do this using is using JaspersoftETL (Talend) and a component called tJasperServerExec

    The custom component calls the API of Jaspersoft to handle the report execution end. There are more components like this coming one day soon that let you use the scheduler built into Jaspersoft, for this example we use the mail sending capabilities of Talend.

    What the video doesn't cover is scheduling of this job. The community editions of ETL rely on you to schedule jobs yourself using cron or the Windows scheduler. The commercial editions allow you to publish the job to the Administration Server which have the ability to schedule from a web UI.

    So here's how it's done: