In Tableau Map plot multiple sites at same lat long - tableau-api

I have a data where at one latitude and longitude multiple shops are located.
For Example.
Latitude Longitude ShopId Type
6.24458 50.001756 101 Saloon
6.24458 50.001756 102 Groceory
6.24458 50.001756 103 Pharmacy
6.24458 50.001756 104 FishMarket
When on map I am plotting using above latitude & longitude I am getting single mark. And when I hover the mark I am getting single shop details but I want 4 marks and on each mark it should show respective shopid and Type.
I am new to Tableau and not able to figure out how to do it.

You are likely getting 4 marks displayed at the same location. So when you click on the mark you see, then you are only selecting the top mark. You can verify this by dragging over the mark to select all the marks within a selection rectangle. If you then, right click and view data, you should see all 4 marks.
Another thing that can help when you have overlapping marks, is to make the marks partially transparent and add a border around the marks. Both options are available by clicking on the Color button on the marks card to get to the advanced color settings.
If this is not the behavior you want, you have a couple of options. One easy approach is to add a little random noise to each latitude and longitude (called jitter). Adding a little jitter makes the marks visible, although the size of the jittering depends on your data and scale. Jittering is especially useful if all your points are geocoded to the same situation - say if every building with a Los Angeles address is treated as if it is located at city hall. In that case, the geocoding distorts the data to a degree that jittering is just fine.
The undocumented RANDOM() function is an easy way to add some jitter. Excel and Hyper Extracts support RANDOM() among other data source types. It returns a number between 0 and 1.
The other options involve treating your coordinates as continuous dimensions instead of measures, and then using some other visual attribute size, color etc to indicate the number of items at each location. It is often useful to combine nearby items with some sort of grid or hex bin function -- In this case, instead of adding random noise to each coordinate, you round or truncate it in someway to effectively snap points to a grid. The ROUND() and HEXBINX() HEXBINY() functions are useful here. When using this approach, be sure your packed coordinate fields are continuous dimensions and have the appropriate Latitude or Longitude geographic role.
Finally, take a look at the density mark type. It can make visual heat maps, either working with exact data points or grid packed points.

Related

How to overlay Long/Lat points on a existing map

I have an existing map of ward in Chicago in Tableau:
I have a separate CSV file, linked to primary data source by Ward. It contains pairings of Long/Lat points. I can make a map of it by itself, but cannot find a way to place the points on this map. How would I do that?
If you want to overlay the dots to the existing area map you will need to use dual axis. Steps to follow are:
drag latitude (or longitude) from the csv datasource to rows (or columns); this will create another map
right click on the newly added measure and select "Dual axis"; this will overlap the two maps
in the marks box on the left you will be able to select different display settings for the two axis you will then have
You can also find a nice tutorial here

Tableau 'map' type messing up sized visualization

I am making a map chart in Tableau where I have lat and long coordinates and I want the dots showing these locations to be bigger or smaller based on the number of mosquitos caught in the specific traps (marked by the lat and lon coordinates). This works perfectly as long as I use the 'automatic' chart type:
However if I switch to the 'map' type, the dots do not represent the sizes anymore. Notice that I did not change ANYTHING else but the chart type:
Could someone explain why this happens and how to 'fix' it?
If you want Tableau to display marks as circles, choose the circle mark type. No need to choose the map mark type unless you are trying to fill regions, say counties. In that case, you would usually put your measure on color instead of size.

Convert Geometry from Multipolygons to Polygons

I have a worksheet in tableau which uses shapefiles of a state at district level. But when I bring it into the view, and hover over anything, all of it gets highlighted. I found out the Geometry is set to MULTIPOLYGONS instead of POLYGONS. How can I convert multipolygons to polygons so I can hover over each district and get their details in the tooltip?
Shapefiles are normally constructed with one Multipolygon per district (at least for districts that need more than one polygon to describe the area as many do). So when you select a single district, you get all the geometry associated with the district. This is intentional and the right behaviour for highlighting districts (or whatever unit you are working with).
What is probably happening for you is that you have displayed a map but haven't put the district identifier onto the Tableau "detail" shelf. In this case the *whole" map will highlight. This has nothing to do with Multipolygons. It is a deliberate choice in Tableau to allow for the possibility of maps containing multiple hierarchical areas.
In the UK, for example, you can get shapefiles with low level census areas called LSOAs. But the data will also contain how these fit together into higher-level areas (MSOAs, local authorities, parliamentary constituencies etc.). Using the low-level shapefile with the higher-area information is possible by dragging the names of the higher-level areas into the details shelf making them the unit of analysis for the map.
If you don't drag any area name into the detail shelf, Tableau will assume the whole map is the unit for aggregation and will highlight everything.
So fix the problem by dragging the unit names or identifiers for your districts to the shelf and everything will work.

Show Separate Mark Labels alongside Measure Value Labels

(source: tableau.com)
I'm using Measure Values for combining two measures:
1)Count of Clients (As a percentage)
2)% Retention (Calculated field which uses another calculated field called Numerator Retention in it's formula over the total to calculate the %)
Measure Value Mark Labels successfully show the respective percentages for the two measures. Now I wanna show the respective count of clients or numbers behind these percentages but I'm unable to do so since I've already used Measure Value Mark Labels to do something similar.
When I try editing the Labels text, it edits it for all labels together and hence I'm getting all labels for all rows and not how I want it to show selectively as I described.
Example Solution: For Private Residence, I only want 125 to show with 60% which is the actual number behind the percentage. And I want only 119 to show with 95%
You can do this, but not using Measure Values. You should mirror what I have done here. I do not know your calculation for the Respective Retention, so use your calculation.
You need to move both of your measures to the Columns shelf and make them a Dual Axis:
After doing that, you will have access to the individual measures - so you can give labels independently:
Just make sure you place the measures that you want for each axis respectively.

Place a marker in each country with mapbox

I am using Mapbox to build a multiple choropleth map.
Something along the lines of this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/choropleth-joined-data-multiple-variables/
I am using countries instead of US states however.
I've got the map working and I can switch between layers
I have an extra requirement however to add a marker in each country that displays how many projects are active in that country.
I found out how I can add custom markers to the map with this example, https://www.mapbox.com/mapbox.js/example/v1.0.0/divicon/
The problem is I need to put a marker in the center of each country.
Does anybody know a way to put a marker in the middle of each country?
I tried to use the natural earth admin 0 label points data but that has multiple points per country. It looked like the 'scalerank=0' points were the middle of the countries but if I filter on these points, I still get multiple points for some countries (russia has 4 for instance, but Belgium has 4 as well).
If you plot all scalerank 0 points on a map you get the following result:
https://a.tiles.mapbox.com/v4/persyval.jg5p7gm7/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLCJhIjoiX3lrSTNYYyJ9.6Ps4OlBCYmlkxQksKsGb7A#6/45.159/12.206
Does anybody know about a dataset that has one point per country or another way to put a marker in the center of each country with mapbox?
It seems it's hard to find a list of country points for the placing of markers.
So I took the mentioned admin labal 0 points and tried to sanitize it to have only one appropiate marker per country.
The result can be downloaded here in GEOJSON format:
https://drive.google.com/file/d/0B6IQhfb-UYeUYk1mcUZaMmV0S1U/edit?usp=sharing
If you want to have a visual representation of the points take a look at this map:
https://a.tiles.mapbox.com/v4/persyval.jgk4767c/page.html?access_token=pk.eyJ1IjoicGVyc3l2YWwiLCJhIjoiX3lrSTNYYyJ9.6Ps4OlBCYmlkxQksKsGb7A#4/36.49/34.32
I needed this points for a proof of concept project so I haven't checked all markers meticulously, I also haven't taken account some of the more political sensitive country borders.
If you have a project in which this is of importance please check the file before using, but the points in this file can be easily edited to your own preferences.