Saving Geoplots to non-.fig files

2 views (last 30 days)
Alan
Alan on 17 Dec 2024
Answered: Ruchika Parag on 6 Jan 2025
Hello,
I have a figure on a geoplot. The figure contains data over a wide area and I need to be able to zoom into smaller regions to see the details. I would like to save this in a format that is not a .fig file that still maintains the ability to zoom in like on a .fig file. I've looked into saving as a kml file, but I want this figure to be easily accessible and doesn't need special software to read. Is there any way to do this easily or will I just need to take many pdf/svg shots and splice them together?
Thanks

Answers (1)

Ruchika Parag
Ruchika Parag on 6 Jan 2025
Hi @Alan, you can create an interactive map using MATLAB's native capabilities, such as exporting to a web-friendly format that supports interactivity. One option is to use the 'webmap' feature, which allows you to interact with geographic data in a web browser-like environment.
Here is a workaround:
  1. Use 'webmap' for Interactive Viewing:
  • 'webmap' allows you to display geographic data interactively within MATLAB. Although it doesn't export to an HTML file, it's useful for exploring data.
% Example code:
lat = [37.7749, 34.0522, 40.7128]; % Example latitudes
lon = [-122.4194, -118.2437, -74.0060]; % Example longitudes
% Create a Web Map
wm = webmap('OpenStreetMap');
wmmarker(lat, lon, 'FeatureName', {'San Francisco', 'Los Angeles', 'New York'});
2. Export Static Images for Documentation:
  • If you need to share your map outside of MATLAB, consider exporting static images at different zoom levels. While this doesn't provide interactivity, it allows you to document specific views.
% Save a static image of the current geoplot
frame = getframe(gcf);
imwrite(frame.cdata, 'geoplot_image.png');
I hope these approaches can help you explore and share geographic data!

Categories

Find more on Geographic Plots in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!