is there a way to create a zip code level Geo Map in Google Data Studio? - google-data-studio

I'm using the Geo Map chart in Google Data Studio.
I'm able to plot data at the state and the city level but not at the zip code level. I'm getting a map with no data as well as the 'This map needs a valid geo dimension' error.
I've filtered all the zip codes to match bigquery-public-data.utility_us.zipcode_area.zipcode so it's not a data issue. I've also flagged the data as 'Postal Code' and 'Text' type but this is not resolving the issue.
Has anyone been able to plot a Geo Map at the zip code level?
I do not want to use Google Maps chart, I'd like to achieve this with the Geo Map chart.
Thanks

Related

Is there a way to get data from a PNG map to a GeoJSON

I have a map which was published in PNG format without its underlying data :
Map produced by the French Gov
I also have this GeoJson of every district in France.
Visualisation of GeoJson file
I need a file that would contain the content of the map in a format I can exploit (Shapefile, GeoJSON, TIFF, etc.). To do that I need to select the districts that are in each of the tiles.
Do you have any idea of a solution that would allow to use the GeoJSON as an overlay over the image to select the districts to put in each category ?
I have tried to georeference the image but that's about as far as I have succeeded.
Thank you

Is Firestore a good database for storing many large objects in?

I have been using React/Leaflet to create a choropleth map that can color any country on the map. What I am trying to do is to develop a save/load function that saves the colored countries and later be able to import it from the database. When this object is saved and loaded, it can bring back the exact same countries that were colored. I have been using firebase/firestore but I haven't been getting any luck.
This is how my object of map data looks like
Is Firestore the right database to do it? Or should I approach another database? I need a database that can store multiple objects in the picture above.
If you can convert that file into a JSON of a size smaller than 1MB, which is the Firestore Document size limit, it is possible. In the case you are proposing I would have the following structure, from the information you shared but fell free to adapt it as you see fit:
Map Collection
field1
...
fieldN
CountriesOptions Subcollection
optionObject: {}
Where each object is a separate document in the CountriesOptions subcollection converted to JSON using JSON.stringify(obj).
For more information on how to structure your Firestore with subcollections you can check this link to the documentation.

Map Postal Codes from BigQuery to DataStudio

I have Postal Codes in BigQuery as strings and I'm trying to map them in DataStudio.
When I do this for States and set the Geo Dimension as Region Code it works flawlessly.
But, when I do this for Zip Codes and set the Geo Dimension as Postal Code it loads the number in the legend bar (see graphic below) but it:
Doesn't map any of the points
and
Doesn't allow me to select a Zoom Area
When I try to select the Zoom area, it states:
This map needs a valid geo dimension before you can set the zoom area.
How can I map Postal Codes (stored as strings) from BigQuery to DataStudio?
1) Postal Codes
Postal Codes are currently supported in the Google Maps Chart.
Adding an image from the Geo dimension reference Support Page for future reference:
Google Data Studio Report and a GIF to elaborate, using Postal Codes in the United States with Google Maps and Geo Maps:
2) Latitude Longitude
Whilst Postal Codes are currently supported in Google Maps, a Latitude, Longitude dimension is supported in both (Google Maps and Geo Maps), thus one approach is to link a Latitude, Longitude value to the respective Postal Code field.
I'll run through a possible workflow in Google Sheets to demonstrate:
Download data from public.opendatasoft.com (US Zip Code Latitude and Longitude) (has over 40,000 rows of data on Postal Code and a respective field in Latitude, Longitude);
Use the VLOOKUP function to link the Postal Codes from the current Data Set and public.opendatasoft.com (US Zip Code Latitude and Longitude) and then add the Latitude, Longitude values; have a look through the Editable Google Sheets for clarification;
Filter Control: Add the component and set the Postal Code field as the Dimension;
Geo Maps: Add Latitude, Longitude as the dimension and use the Filter Control to display the required area.
Added a New Page to the Report and a GIF to demonstrate:

Datastudio Geomap Drilldown vs GoogleMap visualize issues

I was playing with DataStudio GeoMap and GoogleMap features, I used Covid US datased. I made some research what is best for showing charts via GeoMap & GoogleMap, I made report with 6 slides, each slide has Title with used method and I found below issues:
1) Drill down for GeoMap not working often, state/regions not showed,
2) in slide #2 GeoMap: used 3 Geo Dimension: Lat/Long, City, Region : how to show City names ? (and disable Latitude?)
Seems that best way is showing via GoogleMap (slide #6) with Bubble dimension :Lat/Long with Tooltip: City > then values are showing to Cities,
only issue is how to setup default zoom region US, to avoid showing whole world ?
Here is report:
https://datastudio.google.com/reporting/f0201b38-c2ae-400c-8ca0-d65d001c9e3a/page/DOdRB
One note: in My old report from today somehow I was able to create report with drill down 2-layer GeoMap, used Dimension: City+Region > not accurate, many cities are missing:
https://datastudio.google.com/u/0/reporting/a729972f-97ec-4faf-8311-a49719d0826c/page/TeaRB
Trying to import GoogleMap via embded frame, but I got this error>>
Google Maps cannot yet be displayed in embedded reports.
Question 1: Google Maps & Filters
Opened the Report above, exported the Google Maps data to Goggle Sheets, recreated a Data Source and Report, and then had a look through; it seems that the data in the City field is sorted, classifying values outside the United States as NA, in addition, removed 0,0 values in the Latitude_Longitude field, thus this Filter does the trick:
Exclude City RegExp Match (NA)
AND
Exclude Latitude_Longitude RegExp Match (0,0)
Editable Google Data Studio Report and GIF to demonstrate (Feel free to have a look through and edit the Report as required):
Question 2: Geo Maps & Drill-down
The updated Filter in Question 1 should do the trick when using the Geo Maps Chart Type, with all three Geo Types - Latitude_Longitude City and Region working as expected using the Drill-down and the Zoom area set to United States; adding an image of the Filter above for clarification:
Google Data Studio Report and a GIF to elaborate:
Question 3: Embedding Map Charts
Geo Maps can be displayed on embedded reports.
Currently, Google Maps won't appear in embedded reports.

Mapbox GL JS - Highlight Country Polygon

I have a select2 option where a user can select a Continent, Region, Country, City or Airport. I integrated mapbox to add markers to the map on selecting a location.
In case of Country and continent selection I would like to select the whole country/continent instead of just a marker.
I tried using the Mapbox Geocoding API like https://api.mapbox.com/geocoding/v5/mapbox.places/germany.json?types=country&access_token=**** but I noticed it only returns a 'Point' coordinates.
I would like to use a service where I provide the country/continent name and it returns a polygon with all the border coordinates in order to be able to highlight on the polygon on the map.
Does mapbox have a built-in service for such functionality? Or do I need to use a third-party service or json file?
while the Mapbox Geocoding API doesn't return the full polygon geometry for a feature, you can use the Geocoding API in combination with a few other open source data sources and tools.
Here's the beginnings of a workflow you could try out:
query the geocoding api with the text for the country name like "germany" and grab the lon,lat coordinates from the coordinates property of the API response.
use polygon data in geojson format from an open source like Natural Earth: https://www.naturalearthdata.com/downloads/
pass the coordinates and polygon data into this turf.js function: http://turfjs.org/docs/#booleanPointInPolygon
identify the polygon the point lies within and highlight those boundaries on the map. For more on how to use GL JS for the highlighting portion, check out the examples page: https://docs.mapbox.com/mapbox-gl-js/example/query-similar-features/

Resources