Datazen – Connecting Drill Through to Navigation Apps

I just accomplished something very cool in Datazen and I couldn’t wait to share with everyone! I was working on a POC for a client with Datazen. We were doing some review and the client had an interesting request. We were going to add a drill through to information that would contain an address. The client said “If this could be a link that a phone’s navigation would recognize that would be slick”. I thought to myself “oh that would be very cool” and got a little nerd giddy at the thought of trying to do that.

 ***

After doing a little searching I found that you can link to a map using the format: http://maps.google.com/?q=term. The “term” portion is where you would update it with your search. So in my case I can put the address. It has flexibility as well so you can do something like this if you would want: http://maps.google.com/?q=statue of liberty.  When you use that link it brings up the map below.

Lady Liberty

Lady Liberty

Back in Datazen I created a Simple DataGrid that contained the fields I wanted to display including address. I then read the documentation on the Datazen website documentation for custom url drill throughs (http://www.datazen.com/docs/?article=server/drill_throughs_to_other_dashboards_or_custom_urls). The example made me think I had to have a selection be passed to the url. I didn’t want to do that, I just wanted it to pass a field I had displayed in my DataGrid.  However when I started playing with it, it showed my fields contained in the DataGrid as well! Sweet!  So I created a drill through for my DataGrid. In the expression window I put “http://maps.google.com/?q=” then selected the field (SimpleDataGrid3.Address).

***

When testing this drill through on my iPhone it didn’t work (insert sad trombone music).  It would kick me out of DataZen app and go to my home screen but nothing more. It was like it was trying to do something but wasn’t working. I did some more research and found this link (https://developers.google.com/maps/documentation/ios/urlscheme). It refers to the url scheme to launch navigation from apps. So with information from that article I changed the beginning of my link to comgooglemapsurl://maps.google.com/?q=. I test again and it works!

The custom url drill through

The custom url drill through

When I clicked the drill through it would open Apple Maps with that address displayed. Cool egh?! It also then reminded me that I hadn’t changed my default to Google maps which is now resolved as well.

Datazen Custom Map Craziness

I often struggle coming up with ideas for blog posts. Thank you Datazen again for another idea!  After encountering the issue I posted earlier (link to post) when working with maps, I was very anxious to try to create a custom map.  I started working on one with my brewery data.  I ran into several bumps in the process so wanted to share with everyone.

 ***

I had collected several shapefiles through the years playing with spatial data.  I began trying a few of them in Datazen but had a hard time finding any that worked. When I would select them, they would just hang and sit there. Some were very large so I suspected there was a size limit though there wasn’t anything in the documentation. In my testing I couldn’t get anything over 1MB to work. Later Chris Finlan said that the actual limit is 512 KB! Rather limiting but there is a potential workaround by using mapshaper.org to minimize the size. Depending on what type of shapefile you are using it can distort your polygons potentially too much so that workaround only goes so far.

Tweet from Chris Finlan on shapefile size.

Tweet from Chris Finlan on shapefile size.

After getting the size issue nailed down, I continued on with my mission of getting my custom map working. Normally when you use shapefiles they contain a few files. Datazen uses the shp file and dbf file. The shp file contains the polygon information and details to draw the map. The dbf file contains the attributes about those shapes or the data you’ll need to tie to your own data. Below is a screenshot of my dbf file using DBF Viewer 2000 software (free trial then about $50 to purchase after 30 days at http://www.dbf2002.com/).

The original dbf file

The original dbf file

You can see it has a key field (ogr_fid) then zcta5ce10 which is actually field that contains zip code. The zcta5ce10 field is the key I needed to use to tie with my own data containing zip codes. When you use Datazen you can’t select the proper key, and as it turns out it must have the key as the first column in the dbf file! Crazy right?! Using the DBF Viewer 2000 software, I had move the column to be the first in the dbf file.

Updated dbf file to move key column to be first.

Updated dbf file to move key column to be first.

After a bit of head shaking I move on and at this point I was excited to see my custom map working! But wait, why is my data point not where I expect it to be? I was mapping zip codes of breweries in Indiana that have been rated on BeerAdvocate. There is unfortunately only one (though I’d argue that should be more) and it’s Three Floyds which is up near Chicago but the Datazen map wasn’t accurately showing it (see below).

The report displaying the location incorrectly.

The report displaying the location incorrectly.

I opened up the shapefiles in other programs (QGIS/Google Earth) and it was showing correctly both before and after minimization process. After talking with Datazen support it, they sent this info:

 ***

“While I can’t say for certain where things went wrong, I suspect it was due to improper minifying – something got misaligned between the SHP and the DBF and QGIS and Google Earth all read the SHX file to properly map the shapes to the database. Datazen does not do that. We assume a 1-to-1 relation between shape and data: the Nth shape corresponds to the Nth entry in the DBF.”

 ***

I had inadvertently changed the order of the data in the dbf file when I had to edit the order of the columns. Since other programs I use to view shapefiles also use the shx file, there wasn’t an issue with them correctly mapping the shape to the attribute even after accidentally changing the order. A shx file is basically a linking/index file between the shp and dbf files. Be very careful when editing the order of your columns in the dbf file. One accidental click on a column and it can ruin the dbf/shp file from working properly. If they don’t line up, your report can be reporting your data in random polygons! I’m glad I had a very simple dataset and that I knew where Three Floyds was supposed to be located as I may have very easily missed that. Make sure you do some validation on your reports to be safe.

 ***

I’m very interested to see what Microsoft does with Datazen now. I’m intrigued to see what/when any updates to it occur. I’m also interested in others experiences with custom maps in Datazen. Please share in the comments any issues/experiences you encountered.

Datazen – Map Not Working? May Never Guess Why

I recently started learning Datazen, along with a lot of folks since Microsoft purchased them. If you do searches on Datazen, there is information out there but not an enormous amount. There is a great overview video by my friend/colleague Megan Longoria at http://www.blue-granite.com/video-datazen-overview. There is also some nice info at http://www.datazen.com/docs/. However there appears to be a HUGE void in posts that detail overcoming issues with the product. I’m sure that will change as more start digging into it. Here’s my first post to help fill the void. That and my karma can always use boosting so I wanted to get this post out asap in case it helps someone getting started as well.

 ***

Many know I love all things spatial so I was naturally drawn to doing one of the maps in Datazen. I get my data situated just right in Excel (another potential post there). There isn’t much to configure when setting up a map but I then do that. You can see what I had below.

MapBeerData

I have some simple brewery/beer data (shocking I know). I wanted to visualize the location with a bubble and the size of the bubble based on beer ratings. I tried address, city, and then even state with no luck. I had hoped to get a more finely defined location but I knew I could get state by the examples and documentation here (http://www.datazen.com/docs/?article=server/configuring_visualizations). It just wouldn’t work at all and kept returning blank map with no bubbles when I would preview. After a stern cussing, I start to look at the sample tables of other map examples. One of the table examples is below.

StateExample

I noticed they had state spelled out fully. Thinking to myself “No way that’s the problem. No way it’s that picky”. I start to give it a shot. You can see above I had used the state abbreviation. I add a column to my Excel data with the state fully spelled out and put that as the key. Lo and behold that fixed the issue!

BeerMap

Finding that Datazen is as finicky as a spoiled toddler and I’m just getting started. There’s a lot of potential there but Microsoft, you have A LOT of work to do!