Error: "Adding Cartesian plot to geoaxes is not supported."
29 views (last 30 days)
Show older comments
Robyn Seery
on 25 Apr 2021
Commented: Walter Roberson
on 25 Apr 2021
Hi,
I am trying to plot a simple circle over geoscatter map data, however when I try to overlay anything with the geoscatter plot, the following error shows:
"Adding Cartesian plot to geoaxes is not supported."
The code below shows two locations. I would like to overlay a circle of radius d and centre at lat(1), lon(1), but I can't seem to figure out how to achieve this. Is this possible using geoscatter?
lat = [53.372056 53.3771]; % latitudes
lon = [-6.614672 -6.58749]; % longitudes
d = 1.8884e3; % distance between two locations
geoscatter(lat, lon); % plots two locations on map
I am open to any other methods of implementing this if it is not possible using geoscatter. The main requirement here is that the geographic street map data is visible.
Thanks in advance!
0 Comments
Accepted Answer
Walter Roberson
on 25 Apr 2021
Use plotm() instead of plot() or viscircles()
4 Comments
Walter Roberson
on 25 Apr 2021
Perhaps
lat = [53.372056 53.3771]; % latitudes
lon = [-6.614672 -6.58749]; % longitudes
d = 1.8884e3; % distance between two locations
geoscatter(lat, lon); % plots two locations on map
hold on
geoplot(lat(1), lon(1), 'o', 'markersize', 30)
markersize is in points, rather than in geographic units.
You can also construct circles in the usual ways,
r = 20;
[x,y] = pol2cart(linspace(0,2*pi,30), r);
geoplot(lat(2)+x, lon(2)+y, 'k-')
Looks like the units is degrees! Well, this does happen to give a good illustration of the problem I mentioned before, that geoplot is in geographic coordinates, so you have to define whether you want a geographic circle or a visual circle.
More Answers (0)
See Also
Categories
Find more on Geographic Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!