Using HeatmapLayer with data from FusionTablesLayer (Google Maps API) - google-maps-api-3

How can I display a heatmap with the Google Maps API with data from a Fusion Table (Layer)?
With a FusionTablesLayer I can select and display the data (as markers).
layer = new google.maps.FusionTablesLayer({
query: {
select: '\'Geocodable address\'',
where: 'City=\''+city+'\' AND Category = \'companies\'',
from: 'sdfgfdgfsdfewrrtre34534543egffg'
},
heatmap: {
enabled: true
},
templateId: 0,
styleId: 1
});
However, I can't display the data as heatmap. I tried adding 'maxIntensity' and 'radius' as parameters but this did not work. I get a map like this one in this post.
Now, I'm looking to the HeatmapLayer but don't know how to retrieve the data as with the FusionTablesLayer. Somehow the 'query' parameter does not work in HeatmapLayer.
Therefore my question: How can I display a heatmap with the Google Maps API with data from a Fusion Table?

Sorry, there is nothing you can do.
Heatmaps created via a FusionTablesLayer did not have any configurable options.
To be able to use a HeatMapLayer with the data from a FusionTable you must download these data, and the data must include a location(a LatLng, not an address ).
When you didn't store these LatLng's on your own in a column you're not able to get them, the LatLng's created internally via geocoding are not accessible via download.

Related

Grafana maps with rockset and dynamodb

Hy all, i am using grafana with rockset to collect real time series form our dynamodb database, but we have the next problem in the plugin maps.
My data with the next query:
select country,real,_event_time from commons.Players
is
'US' '0.5' '2020-05-27T08:40:51.548000Z',
'UK' '0.2' '2020-05-27T08:40:50.548000Z'
I read that i must pase the country code in the group by:
select
country,sum(real) as total ,_event_time
from commons.Players
group by _event_time,country
but this doesn't work, I select the correct type of location data (countries) but impossible to see anything.
I don't have problem with any kind of graph but in the map is impossible to my to see the information. I have read documentation and really I don't understand the query that i must use in this part to see the data.
Thanks for everything.
You didn't post your panel configuration so it is blind guess. Use query:
SELECT
_event_time AS "time",
country AS "code",
real
FROM commons.Players
and configure Map Data Options->Location Data: countries to "translate" 2 letter country code to map coordinates.

How to you combine two dataLayer variables into one in Google Tag Manager

There are two dataLayer variables on the page. How do you combine both of them into one single variable so that it can be pushed into analytics ?
dataLayer current format
PageName: AIR_SEARCH_PAGE
Flow:BOOKING
I want to create another variable which is XYZ and the result to be displayed as BOOKING:AIR_SEARCH_PAGE. How to achieve this ?
XYZ:BOOKING:AIR_SEARCH_PAGE
There are several options here:
Combine the strings through GTM. For example, looks like you have the following dataLayer:
dataLayer = [{
'PageName': 'AIR_SEARCH_PAGE',
'Flow': 'BOOKING'
}]
In GTM, you could create a DL variable for 'PageName', and another one for 'Flow', and then when you need to combine them, or add other text around it, you can say:
XYZ: {{Flow}}: {{PageName}}
so this would render as "XYZ: BOOKING: AIR_SEARCH_PAGE"
Use the JS string manipulation and join the strings together and then push to the dataLayer again.
Push a new parameter into the dataLayer that combines the strings for you.
dataLayer.push({
'xyz': 'BOOKING:AIR_SEARCH_PAGE'
})
and then use that new variable through GTM.
I think the first method may be best.

How does Google Maps decide when to use a specific icon?

I am using the Google Maps Places library to do a search for nearby hospitals, but it returns results that aren't necessary hospitals (but have 'hospital' as one of their types). However, I've noticed that actual hospitals have a hospital icon on the map, so Google must somehow know which establishments are actually hospitals. Does anyone know if the public has access to this data?
This is the icon I'm referring to: https://www.dropbox.com/s/1jfqcayxavjhlyi/Screenshot%202015-03-17%2017.20.19.png?dl=0
Example of request I'm making:
var request = {
location: self.location,
radius: 20000,
types: ['hospital'],
keyword: 'hospital'
};
Example result that isn't a hospital:
{"geometry":{"location":{"k":44.815958,"D":-68.808244}},
"icon":"http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png","id":"de6e60bd70b90ba4cb86afe149a60169553607f1",
"name":"Penobscot Community Health Center",
"opening_hours":{"open_now":true,"weekday_text":[]},
"photos":[{"height":320,"html_attributions":[],"width":320}],"place_id":"ChIJj--4INRKrkwRN0z2XkoJtVU",
"rating":3.1,
"reference":"CoQBdAAAADmf3YA0659efzMbCSPOK6SZttkfus7aWBDhrZZyX63Szl256BRcpz81LH6rIuONldYv256tsN7Zv-N6ZkOkJadlD2VS01bs7C4ierKvGUMyJOJu657xL5MvidF3Tgs9iejeJcXsxjDJYOwtN3m3sbfClfWYVnnIL4hMLYV8P9TnEhBurfJv_30CAG2wp1V73POVGhR-7fz1mCdh4OYWSa3Pw0mPupckoQ",
"scope":"GOOGLE",
"types":["hospital","pharmacy","store","health","establishment"],
"vicinity":"1012 Union Street, Bangor",
"html_attributions":[]}
My guess is there are a couple ways to get around this. You might remove the keyword argument from the API, which acts like a search term rather than a specific match on a type of location like the type field does.
You may want to be careful about your radius value choice.
Next, if you do a search on Google Maps in general you'll get a broad assortment of results. Do you need every result to be an actual hospital or can you do your own filtering afterwards?
If you do your own filtering it looks like type information and even icons are embedded in the result JSON. You might see if there's a distinguishing characteristic between the types of results you want and filter by that. Otherwise, any additional graphical data would not be accessible via the API.

Google Analytics - How to filter by page, group by query string value?

I have a site with a store search that posts in the following format.
www.site.com/store-locator?city=&province=&zip[postal_code]=68123
I am trying to configure GA to give me feedback on people visiting this page and a count of specific zips searched.
example report data
/store-locator?city=&province=&zip[postal_code]=68123 1000 visits
/store-locator?city=&province=&zip[postal_code]=68456 768 visits
/store-locator?city=&province=&zip[postal_code]=68789 221 visits
note: the 'city' and 'province' values may also be populated (and I will want to mod GA to give similar data on these too).
Can anyone give feedback on how to configure GA to give me data similar to this?
Thanks!
As far as I know, the only way to look at this type of segment historically is using individual segments, which doesn't work well for an arbitrary number of zip codes. However, you can collect this data more effectively as described for new traffic. This comes up often with information like categories, tags, dates, query string variables, etc.
You can create Segments for each zip. This will work for historical analysis, but is impractical beyond a few. https://support.google.com/analytics/answer/3124493?hl=en&ref_topic=3123779
You can also use Content Grouping to create groups. This will not work historically. https://support.google.com/analytics/answer/2853423
The way I've handled this is using Custom Dimensions, which replaced Custom Variables when Universal came out. This also only works for future data.
To use Custom Dimensions, you would pass the zip code to google analytics explicitly when calling the analytics javascript code.
You can pull querystrings with javascript, or echo the parameter using something like PHP as follows:
<?php
if (array_key_exists("zip",$_GET)) { $theZip = $_GET["zip"]; }
else { $theZip = "nozip"; }
?>
And, sending the custom dimension --
ga('create', 'UA-XXXXX');
ga('set', {'dimension1': '<?php echo $theZip; ?>'})
ga('send', 'pageview');
You also need to setup the custom dimension in the Analytics Profile. Docs on custom dimensions https://developers.google.com/analytics/devguides/platform/customdimsmets
/store-locator?city=&province=&zip[postal_code]=68123 1000 visits
Step 1: In GTM, create a new macro. I called mine {{province}}
Macto Type = URL
Component Type = Query
Query Key = province
This will populate the Macro with the value of province from the query string.
Step 2: In your Google Analytics property, define a custom dimension called "province". This will assign an index key to the dimension.
Step 3: In your GTM tag for Google Analytics, you will find Custom Dimensions under more settings. Add a new dimension, apply the index number from #2 and for the dimension select the macro you created from #1
Publish and you are all set.
Now when you look in Google Analytics, you can add a secondary dimension and choose your newly created custom dimension.

Can each layer in a Bing map have its own datasource?

If so, is it possible to bind that datasource to the layer so that it produces the appropriate number of pushpins based on values in the datasource?
If you just want to split the layer to manage your pushpins in an easier way, you can add some entities to your map like following:
pinLayer = new Microsoft.Maps.EntityCollection({ zIndex: 13 });
map.entities.push(pinLayer);
Follow this Link to get more explanation about layers on Bing Maps

Resources