How to use tree function from App designer to trigger a map/plot on and off

2 Ansichten (letzte 30 Tage)
I am running an app that has to incorporate a map. I am using a base map and I will do the task on top of that. So I used a "tree" function. And using the code below I am able to draw the map inside my canvas.
geoaxes(app.UIFigure,'Basemap','streets')
  1. I have two main questions, when I select the tree the map will show but when I unselect it the map still shows there.
2. Second question is when I am runnding the code out side of this app designer I can fetch the latitude and longitude of the map but not here. Because on this application I want to fetch latitude and longitude (that will be used for processing later)
I dont know what is wrong here so I didnt know how to approach it
3. and finally I have also tried moving the map inside the canvas using "guimove" but I am able to move the whole window not the map inside the canvas. just looking if there is a special function.
I did
gx = geoaxes(app.UIFigure,'Basemap','streets')
guimove('gx', 'right')

Antworten (1)

Kevin Holly
Kevin Holly am 24 Jan. 2023
  1. Have you tried cla?
  2. You can obtain this information from the axes handle. See below. Notice handle is saved as variable h.
  3. Use geolimits. See below for an example. Note, running these lines on my desktop MATLAB did not change the Latitude coordinates.
fig = figure; % Using figure because uifigure is not supported on this site, but it should work for uifigure as well (App designer uses uifigure).
h = geoaxes(fig,'Basemap','streets');
geolimits(h,[-60 60],[-30 30]);
h.LatitudeLimits
ans = 1×2
-60.0000 60.0000
h.LongitudeLimits
ans = 1×2
-95.5493 95.5493
fig = figure; % Using figure because uifigure is not supported on this site, but it should work for uifigure as well (App designer uses uifigure).
h = geoaxes(fig,'Basemap','streets');
geolimits(h,[-60 60],[-30 30]);
geolimits(h,[h.LatitudeLimits],[h.LongitudeLimits(1) h.LongitudeLimits(2)+40])
h.LatitudeLimits
ans = 1×2
-67.0066 67.0066
h.LongitudeLimits
ans = 1×2
-95.5493 135.5493
  1 Kommentar
Surafel
Surafel am 27 Jan. 2023
Thanks Kevin, so for the second question. I am trying generate a gpx file because Matlab can only read but not write a gpx file (I am not sure its just I can not find it on the documentation)
so my approach is I wanted to do a geoplot () ... draw a line between two points then use datatip to fetch all the latitude and longitude between the points (or latitude and longitude on the line) then save it to a variable to fetch the poiints later. (I already have a python script to generate the gpx). But I would need the values from matlab first. However it is not working and my question was if there is a better way to do it. And thank you for replying the other questions are answered.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by