Convert Geometry from Multipolygons to Polygons - tableau-api

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.

Related

Tableau packed bubbles - arrange the bubbles custom

I'm looking to create a packed bubble graph like the below (size of the bubble corresponds to population, and the color of the bubble corresponds to number of widgets sales). The graph is exactly the way I need it, except that I would like to arrange the countries so that they are grouped by continent. Is there a way to do this in Tableau?
I've tried to recreate a similar scenario even though it's not clear if the bubble color should (or not) be related to a specific field.
That being said, using the superstore dataset, I've "grouped" customers by region (color) so they are some how aligned through inner circles.
In order to do so, I just sorted the region pillow in the detail section.
See below.

Calculate areas of new features in merged layer in QGIS

I have merged four different layers into one new one in QGIS, but I want this layer to have different information then the old layers. I want all the buffered 'islands' to have a different ID and a calculated area. However, now in the attribute table I just see four features, one for each layer that I merged. Is there a way to update the attribute table to consist of new features (one for each 'island')?
This is what the layer looks like:
And this is what the attribute table now looks like:
And this is what I want (the 5th and 6th column especially):
You must create a feature for each monopart geometry, you can achieve this using the 25.1.18.46. Multipart to singleparts tool, and then use the field calculator to get the area, you can find here how to calculate area Calculating polygon areas in shapefile using QGIS.

In Tableau Map plot multiple sites at same lat long

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.

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

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.