Google Data Studio Geo Map stays blank while using Lat,Long as Dimension - visualization

I want to use Google Data Studio to visualize the location of NGO´s in Europe. Some of these share the same HQ Location in the Data e.g. Italy Rome. Idea is to transfer these into Lat,Long coordinates and slightly manipulate the values to show them with their name in the GMaps bubble diagram. The original data is unfit, because the digram cannot display multiple tooltips/names for the same location.
I have been following this guide https://michaelhoweely.com/2020/05/04/how-to-build-a-custom-google-map-in-data-studio-using-google-sheets-and-geocode/ to do the Geo Coding of the locations.
Problem is that the Geo Chart goes blank if I choose Lat,Long as the location dimension. Even the original data (not modified by me) will cause the same issue.
GDataStudio_Lat_Long_Vis_Issue
Any idea of what I am doing wrong here or having a better idea of how to do the visualization?

You also have to make sure you change the type to GEO, as it sometimes defaults to ABC or numeric.

It may help to concatenate the latitude and longitude values to follow the WKT format, as shown below.
CONCAT(<longitude_column>, ", ", <latitude_column>)
In the current state, the latitude and longitude are reversed, so the error is probably caused by each value exceeding the default range for latitude and longitude.

Related

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.

Plotting maps dynamically based on the availability of geographical data

I have a table with House, Streetname, City, Post code, Country, Latitude and Longitudes. As the latitude and longitudes will not be available for all the addresses, I would like to implement a logic in tableau that will use the co-ordinates (if available in the data), otherwise, Tableau has to plot the maps based on country and post code.
The dashboard that I am using currently is plotting the maps based on Country and Post code only. Is there a possibility to implement the logic explained above, to make the dashboard even more better? Please help.
Thanks,
Ram
If you want to get map according to your requirement as citywise or zipcode wise etc
Follow the steps as under:
Step1:
[map according to city]
as https://i.stack.imgur.com/in38c.png
It will automatically change the map according to zip code etc

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.

Put points on the map, longitude/latitude not where they should be although SRID the same

Thank you for looking at this - I'm sure it's a simple question but this is all very new to me and after a lot of internet searching my points are still in the sea!
I have a set of UK postcode data that I have converted into latitude and longitude. I also have a UK counties shape file.
The code that I have used to convert the latitude/longitude to a geometry point column is as follows:
ALTER TABLE colic ADD COLUMN longlat geometry(POINT,27700);
update colic set longlat = st_setsrid(st_point( longitude, latitude), 27700);
And this produces a column that has values as follows (I've only included a couple!):
"0101000020346C000048BF7D1D3867E83FC05B2041F1334A40"
"0101000020346C0000F085C954C1A8F7BFA1F831E6AE954A40"
"0101000020346C000020D26F5F07CEF4BFE3361AC05B504A40"
"0101000020346C00007D3F355EBA49F73FB6847CD0B3614A40"
The .prj from my shape file is:
PROJCS["British_National_Grid", GEOGCS["GCS_OSGB_1936",
DATUM["D_OSGB_1936", SPHEROID["Airy_1830",6377563.396,299.3249646]],
PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",400000.0],
PARAMETER["False_Northing",-100000.0],
PARAMETER["Central_Meridian",-2.0],
PARAMETER["Scale_Factor",0.9996012717],
PARAMETER["Latitude_Of_Origin",49.0], UNIT["Meter",1.0]]
And I set its SRID to 27700 when I upload it using the PostGIS shapefile uploader.
In PG Admin, when I ask:
select st_srid(geom) from counties limit 1;
select st_srid(longlat) from colic limit 1;
I get 27700 for both.
But...when I try any spatial query I get no response, and when I load the layers into quantum, the point data are off the tip of Cornwall in the north Atlantic, and only represented as one dot on the scale of the counties map.If I zoom in on them, they are 'there', but just not in east anglia where they should be!
This is my first attempt at both SQL and mapping - I'm sure there is something really simple that I have missed.
You are mixing up spatial references (SRS). The SRS in the .prj file (aka SRID=27700) is projected eastings and northings, which have units of metres. This is not latitude and longitude! Furthermore, it is a deception to call a column longlat when it isn't for longitude/latitude coordinates.
If you try to insert latitude/longitude in a column with SRID=27700, the points will not behave as expected, e.g., they will be in the far bottom left corner of a map.
If you have lat/long data from WGS84 (SRID=4326), you can transform this to eastings and northings:
UPDATE colic SET
geom = ST_Transform(ST_SetSRID(ST_Point(longitude, latitude), 4326), 27700);

Problem with location aware XML file

I am making location aware application. I have XML file on server containing information of different stores with latitude and longitude coordinates.
Now in my application i can get my current latitude and longitude coordinates and can parse XML file as well.
But how can i figure out nearest store according to my current coordinates from XML file?
If we use google Api it returns you xml file containing nearest locations according to query. but here in my case i am using xml file on server.
Please suggest
I think you'd be better off converting your data into a DB format (sqlite/mysql) so that the user can submit their lat/Lng point and just get the correct item returned...otherwise you'd need to parse and compare the whole file each time...but, you can still use that formula (it's really just shifting the comparison step to the DB query rather than within your app)
Edit: this has an example of a SQL query that implements haversine and returns x results: MySQL Great Circle Distance (Haversine formula)
This is the haversine formula for calculating distance between two points on the earth:
a = sin²(Δlat/2) + cos(lat1)*cos(lat2)*sin²(Δlong/2);
c = 2*atan2(√a, √(1−a));
d = R*c;
You can easily adapt it in obj-c.
Please note: R is radius of the earth = 6,371km;
So just calculate the latitude and the longitude difference of both points and calculate d based on it.
Hope this helps.