Hello,
I have a heatmap and I want to overlay it onto a World Map. My data is commercial air traffic tracks. I created a world grid (example 1x1 lat/long squares) and counted how many times an aircraft flew through each lat/long polygon. Specifically. I've created a two position arrays, lat and long (center points of each polygon) and corresponding array C which contains the counts. Easy to produce heatmap from there. The problem is overlaying the heatmap onto a World Map.
This seems like it should be super simple; especially since I have the mapping toolbox. But I have been doing research for DAYS and haven't found anything that works.
This post (https://www.mathworks.com/matlabcentral/answers/259878-plot-heat-map-on-map-using-latitude-longitude-and-my-data-value) is close but I don't know how to make the MarkerSize equal to the area covered by lat/long polygon. This example (https://www.mathworks.com/help/thingspeak/create-heatmap-overlay-image.html) also looked promising by the size of worldmap('world') is [1,1,1}.
Please HELP! This seems like a few lines of code at this point but I can't make it work.
Thanks

2 comentarios

jonas
jonas el 8 de Oct. de 2018
Editada: jonas el 8 de Oct. de 2018
You need some shapefile, I dont know which ones that are available from the mapping toolbox but you can find anything on arcgis
After that its a two line code with shaperead and geoshow
MCM
MCM el 8 de Oct. de 2018
I wish it were that simple. You can't put a shapefile on a heatmap. It causes an error
  • When I create a world map first using the 'landareas.shp' shapefile and then try to add heatmap, I get "Adding HeatmapChart to axes is not supported"
  • When I create the heatmap first and then try to add the shapefile, I get "Patch cannot be a child of HeatmapChart

Iniciar sesión para comentar.

 Respuesta aceptada

jonas
jonas el 8 de Oct. de 2018
Editada: jonas el 8 de Oct. de 2018

0 votos

Here's some code from an old script of mine. Here's where I got the shapefile ( naturalearthdata.com, the first link)
worldmap('world')
Borders_shp=shaperead('ne_10m_admin_0_countries.shp')
LandBorders=geoshow(gca,[Borders_shp.Y],[Borders_shp.X],'linewidth',0.25);

4 comentarios

MCM
MCM el 8 de Oct. de 2018
I have shapefile already. Thanks. I need to overlay the heatmap onto the shapefiles (or vice versa). Seems simple as both contain georeferences but I'm having no luck.
jonas
jonas el 8 de Oct. de 2018
Editada: jonas el 8 de Oct. de 2018
Wew, did not realize that you used an actual heatmap object. My first advice then, do not use the heatmap function for this. Heatmap objects are really difficult to customize. Use hist3, imagesc or something similar.
MCM
MCM el 8 de Oct. de 2018
Thank you so much! Two lines of code with hist3. I knew it had to be that easy but I was ripping my hair out with heatmap object. :)
jonas
jonas el 8 de Oct. de 2018
Cheers! :)

Iniciar sesión para comentar.

Más respuestas (0)

Comunidades de usuarios

Más respuestas en  ThingSpeak Community

Preguntada:

MCM
el 8 de Oct. de 2018

Comentada:

el 8 de Oct. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by