Posts

Showing posts from September, 2013

Tableau : Convert ESRI shapes into Tableau Format

Image
Click here for other Tableau related Blogs Requirement is to convert data in ESRI Map shapes into Tableau format. Tools Required Quantum GIS -  http://www.qgis.org/en/site/ Python  Download the below Python Code -  https://github.com/venkat-vs-id/python import csv import re import sys #def convertESRI2TableauFormat( p_inputfile, p_outputfile): l_outfileName = 'c:/ESRI_suburb_tab_format.csv' # make changes here.. l_ESRIFileName ='c:/ESRI_suburb.csv' # make changes here.. rdx=0 csv.field_size_limit(sys.maxsize) outfile = open( l_outfileName, 'w', newline='') csvWriter = csv.writer( outfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) with open( l_ESRIFileName, 'r') as csvfile: csvR = csv.reader( csvfile, delimiter=',', quotechar='"') for row in csvR: rdx += 1 ci=0 rowValues = [] rowValues.append(row[1]);# ssc_code rowValues.append(

Tableau - Accessing Tableau's DB

Image
Click here for other Tableau related Blogs Please note that TABLEAU does not advice anyone to access their DB. So if you are doing it you are on your own. Tableau has 2 DB Postgresql for managing all its reporting repositories FireBird for mapping repositories Tools Required pgAdmin 3 for PostgreSql Flamerobin for FireDB Accessing Tableau's PostgreSQL DB Tableau has 2 buitin userid tableau = with read-only access to some of Tableau's view tblwgadmin = admin user will all privileges Please note tblwgadmin is like a admin user, so if you are using this you have to be very careful. Or if you dont admin privs but just need enough access to read the tables then use just "tableau" user. Get access for "tableau" user.  First set a password for "tableau" userid open command prompt go to <Tableau_Home>\Tableau Server\7.0\bin run -  tabadmin dbpass <give a password> Restart the server Now open pgAdmin3 and from

Tableau: Convert Oracle Spatial Data into Tableau Format

Click here for other Tableau related Blogs I had requirement to shapes we had in Oracle Spatial data( which we used for MapInfo) in Tableau. Since tableau doesnt support Oracle spatial type columns, I had to extract that data in Tableau readable format. Here are the steps to convert oracle spatial data into format useable by Tableau. Run the Oracle package ven_OraSpatial_2_TabData in your oracle environment. Now run the below "ConvertDataFormat" code to extract the data into Tableau format Now use extracted data in tableau ( refer to my blog -  Tableau Maps - Custom shapes / polygon - Basics ) You can also download the code from this link -   VEN_ORASPATIAL_2_TABDATA.zip Oracle package ven_OraSpatial_2_TabData SPEC CREATE OR REPLACE PACKAGE VSUBR.ven_OraSpatial_2_TabData as ----- TYPE TYPE rec_LatLong IS RECORD( Polygon_ID NUMBER, LAT NUMBER, LON NUMBER ); TYPE tab

Bayes Theorem | Disease problem Solved

Recently I came across a puzzle which can be solved by using Bayes probability theorem.  Thought I will share that. Puzzle: If a person has malaria, there is a 90% chance that his/her test results are positive. However the test result are not very correct, There is a chance for 1% error. Also only 1% of the total population get affected by Malaria. Now one person's test result came out as Positive. Whats the odds that he will actually have Malaria. Bayes theorem: Before getting into the solution - here is the simple explanation of Bayes theorem. Bayes theorem gives you the actual probability of an event from the measured test probabilities and the skewness . In other words - If you know the real probabilities and the chance of skewness ( i.e. false positive and false negative), you can make correction for measurement errors. Solution: Applying Bayes formula                                            P( T | M ) * P( M ) P( M | T ) =  ----------------------------

Tableau Maps - Custom shapes / polygon - Basics

Image
Click here for other Tableau related Blogs In many situations we would like to draw our own custom shapes on the maps, so that we can report the data more geographically. To draw custom shapes in Tableau, you have to first understand how the custom shapes works within tableau. Image-1 : Polygon shapes in Tableau 1. Each shape is a polygon. 2. Each point_id links to a co-ordinate( i.e lattitude,longitude). 3. The point_id value is used to tell tableau the order (or path) in which the polygon has to be drawn. 4. So in the above example SatisticalArea = "area-1" has more than 1 shape and see how the polygon_IDs are different and for each polygon_ID the point_id are in a sequential order. This how a sample data looks like Attached is the result from tableau (just has custom shape of few areas) Here is an working Example - Ven_Custom_Shapes_Example