Using mouse button to get lat long coordinates

5 ビュー (過去 30 日間)
Gianfranco
Gianfranco 2022 年 11 月 30 日
コメント済み: Kevin Holly 2023 年 1 月 24 日
I am using App Designer to display maps. When a check box is selected, the map will be displayed. This works fine. However, I would like to click on the figure and get the latitude and longitude of that point. I tried to use inputm but I get the following errors
Error using gcm>checkaxes
Input is not an axes handle.
Error in gcm (line 24)
h = checkaxes(varargin{:});
Error in inputm (line 45)
gcm(hndl);
Not sure what the errors mean. How to get the lat long with a mouse click ? What am I not doing correctly ?
% Value changed function: StreetViewCheckBox
function StreetViewCheckBoxValueChanged(app, event)
app.street_view_selected = app.StreetViewCheckBox.Value;
if app.street_view_selected == 1
app.fig_street = figure('Name', 'Street View');
app.fig_street.Position = [1350 700 1200 800];
app.street_view_handle = geoaxes("Basemap","street","ZoomLevel",12);
hold('on');
geoplot(app.street_view_handle, app.obslat, app.obslon);
[lat, long] = inputm(1);
else
close(app.fig_street);
end
end
  2 件のコメント
Surafel
Surafel 2023 年 1 月 23 日
Hi, I am doing the exact thing and I am having issue please. Can you help? I am using tree to display map. I have different maps under tree and when maps are checked map should display and has to be off when turned off. so next I want to use mouse click event to get the lat and longitude value. Tried it for a day and didnt work
Kevin Holly
Kevin Holly 2023 年 1 月 24 日

サインインしてコメントする。

採用された回答

Kevin Holly
Kevin Holly 2022 年 12 月 2 日
the inputm function does not work with geoaxes. Try using ginput instead.
[lat, long] = ginput(1);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMap Display についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by