How to optimize a KML intended to display a heatmap - performance

I just created my first heat map https://visiolittoral.fr/IGN_TEST_HEATMAPS.php.
It works but takes a while to display.
The KML contains 42712 placemarks which represent the 42712 raw data to be analyzed.
Would it be wise to group all the data with the same coordinates into a single placemark by summing the number to be analyzed?
Will the map be the same as the current map?
Ideas ?

Related

Passing coordinates values from google sheets columns in static map URL

I've been trying to fill a google spreadsheet column with static satellite maps giving the coords from latitude and longitude columns.
Something like this:
=IMAGE("https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/"&K1&","&J1&",14.25,0,60/600x600?access_token=API_KEY")
My problem is constructing the API call using Lat, long pairs stored in the Google Sheet cells.
I am getting a range of errors from both Google sheets and mapbox, so obviously my syntax within sheets is bad. When I type the url in a browser, with hard-coded lat,lng the correct map image is displayed.
A typical Google error is
Function ADD parameter 1 expects number values. But
'https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/' is a
text and cannot be coerced to a number
Can someone please assist?
I think you had Lat, long wrong way around. Some mapping systems require Lat, Lng and others Lng, Lat (go figure!)
If you change as below, you will get an image, but you may need to play with other parameters to get it working as you need.
=IMAGE("https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/"&K3&","&J3&",14.25,0,60/600x600?access_token=API_KEY")
You can also use the form below which is another way to construct the API string from the component parts.
=image(concatenate("https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/",K3,",",J3,",14.25,0,60/600x600?access_token=ACCESS_KEY"))
In both cases, the parameters after the Coordinates represent the desired zoom, orientation angles and image resolution. You can play around with image formats here https://www.mapbox.com/help/static-api-playground/.
Also note that you have options in Google sheets to adjust how the image is displayed (resize, stretch etc) in the cell, using the IMAGE parameters. This is explained here https://support.google.com/docs/answer/3093333?hl=en

chart using multiple data from a single row

In my data I have multiple columns containing sensor data, eg:
time,sensor1,sensor2,sensor3,etc.
I would like to create a row/bar/pie chart with the count/avg/etc. where every row, bar or pie segment is a different sensor. Until now I haven't figured out, how to achieve this, because in the examples the dimension always selects one value.
Any suggestions on how to achieve this?

Using ONS maps with D3

I'm sorry this is probably a very basic issue, but I just can't seem to figure it out.
I wanted to map some data using D3.js and the map shape I wanted to use is provided by the UK's Office for National Statistics. I managed to get their geojson data to display, but as soon as I try to do anything with scaling, transforms, topojson, I've been a complete failure.
I've been through many, many, different approaches and I think it's something about the map data that is causing the issue. If I open the shape files in Mapshaper it looks perfect. If I export as geo or topojson and re-import, it looks perfect. If I try to run geo2svg on the geojson export it produces a lot of data, but nothing visible. If I try to import the original shape file into mapstarter.com it produces a flat line. And if I put the topojson into the D3 v4 bounding example I end up with a load of random triangles.
So, can someone show me how do you get ONS mapping data such as http://geoportal.statistics.gov.uk/datasets/1bc1e6a77cdd4b3a9a0458b64af1ade4_3 to display in a d3 example such as https://bl.ocks.org/iamkevinv/0a24e9126cd2fa6b283c6f2d774b69a2?
Thanks
The data that you have linked to is projected. Mapshaper supports projected data, but using d3.geoProjection with projected data will result in no data being displayed in most situations. You need to ensure your data is in lat long pairs for proper display with a d3.geoProjection.
Luckily, in Mapshaper you can reproject your data. Copy all the files of the shapefile into mapshaper, and in the console change the projection to wgs84 (unprojecting your data):
proj wgs84
This data is now easily displayed and manipulated using a d3.geoProjection. Here is an example using the data that you referenced. Also a screenshot:
Lastly: It is possible to display projected data as well, but this is much less common.

how to create map from given coordinates in d3js

So I need to create the map of my country from the coordinates I have so that I can plot some xyz data on it.
I was able to plot the map with the help of Mike Bostock tut http://bost.ocks.org/mike/map/
But when I went through the .json file, the coordinates mentioned are totally different from the coordinates I have. Like Patna(India) has [5812,6567] as coordinates in the json file while actual coordinates are [25,85].
Could anybody guide me how can I use the coordinates with me to plot the map and then display some data on it??
EDIT:
With the help from #user1614080, I was able to understand how coordinates are converted into screen coordinates.
The issue I have is: I want the map of India in a certain way. For that purpose, I would like to use the list of latitude & longitude I have. But I dont know how to convert these lat-longs into topojson/geojson format.
For the time being I did a simple line plot with the lat-long I had. Some of the values from the coordinates.csv I used for the line plot are:
Longitude,Latitude
88.75,21.58
88.33,21.50
88.17,22.08
88.00,21.75
87.58,21.58
87.08,21.42
But I would like to use topojson/geojson for the same. how can I convert the data from "coordinates.csv" into json?

How to draw a continuous line chart from a csv with empty values?

I have a CSV file containing values that are mesured at different paces.
I want to display it as a single chart with several continuous lines.
Here is a sample of the data as it is recorded:
"date","Value button A","Temperature room1","temperature room2","Hygrometry","CO2 room1"
2012/12/22-11:34,,21.6,,40,390.08
2012/12/22-11:35,,21.6,,40,390.08
2012/12/22-11:36,,21.6,19.7,40,390.08
2012/12/22-11:37,,21.6,,40,390.08
2012/12/22-11:38,,21.6,,40,390.08
2012/12/22-11:55,,22,,40,390.08
2012/12/22-11:56,,22,,40,390.08
2012/12/22-11:57,,22.1,19.9,39,390.08
2012/12/22-11:58,,22.1,,39,390.08
2012/12/22-12:11,,22.3,,39,390.08
2012/12/22-12:12,,22.3,,39,390.08
2012/12/22-12:13,,22.3,,39,390.08
2012/12/22-12:14,,22.3,19.8,40,390.08
2012/12/22-12:37,,22.7,,39,390.08
2012/12/22-12:38,,22.7,,39,390.08
2012/12/22-12:39,,22.7,20.2,39,390.08
My chart should have x-axis with dates and y-axis with values.
As you can see here, "temperature room2" values are only stored when temperature changes.
Is there a way of displaying continuous lines with this data without having to fill the empty cells of the CSV data ?

Resources