MATLAB Answers

how to create and load a fixed image file ,georeference this image and use it as a basemap to create a movie of a fixed geographic scene with a changing overlay

5 views (last 30 days)
Stephen Forczyk
Stephen Forczyk on 29 Sep 2021
Commented: Kevin Holly on 29 Sep 2021
I have a script that will use the Matlab toolbox to create a movie using GOES 16 satellite fire hot spot data . The script works but is very slow running. Examining the map and using the profiler it is evident that the unchanging basemap which maps a single state at a time to include county borders,major roads,rivers and cities runs slowly. Upon the basemap is plotted the Hot spots (as points) which vary from one frame to the next. My idea is to created a fixed geotiff image (slow the first frame will take time) but all subsequent images will load this into an exisiting map axis add the hot spots and then use getframe to capture the frame to a movie object. I have had only limited success at this. Most of the variations I tried fail when i execute the following lines of code.
info=imfinfo(GeoTiffFileName);
rasterSize = [info.Width info.Height];
Rpix = georefcells(latlim,lonlim,rasterSize,'ColumnsStartFrom','north');
RGB2 = imread(GeoTiffFileName);
cmap=jet;
geoshow(RGB2,cmap,Rpix,'DisplayType','texturemap');
The error message follows
Error using geoshow
Expected input number 1, LAT, to be two-dimensional.
Error in checkGeolocatedDataGrid (line 18)
validateattributes(c1,{'numeric'}, attributes, fcnName, rules.C1, rules.posC1C2(1))
Error in validateTextureComponent (line 80)
checkGeolocatedDataGrid(dataArgs{1}, dataArgs{2}, ...
Error in validateGeoRasterData (line 23)
[dataArgs, R, imageIndex, rules] = validateTextureComponent( ...
Error in georastershow (line 144)
validateGeoRasterData('geoshow', dataArgs, displayType);
Error in geoshow (line 242)
The original image was taken using the code
baseframe=getframe(gca);
imgdata=baseframe.cdata;
imwrite(imgdata,GeoTiffFileName);
Any ideas would be appreciated
h = showFcn(varargin{:});
Error in DisplayABIL2StateFireDataMovieRev2 (line 771)
geoshow(RGB2,cmap,Rpix,'DisplayType','texturemap');
  1 Comment
Kevin Holly
Kevin Holly on 29 Sep 2021
My guess is that the function may be reading the data in a format analogous to geoshow(lat,lon,X,cmap) instead of geoshow(X,cmap,R)
When looking at the documenation, it states:
"Indexed image with color map defined by cmap, specified as an M-by-N array. lat and lon must be M-by-N arrays. If specified, 'DisplayType' must be set to 'image'."
You have the 'DisplayType' specificed as 'texturemap'

Sign in to comment.

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!