Problem with Web Map
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello, I'm trying to upload several gpx traces on a web map. The basic code is
webmap('worldimagery')
for i=1:n_route
wmline(route{i});
end
whre route is a cell array with n_route gpx traces.
The for-loop cracks after 12-15 loops and the following error appears "The web map page has not finished loading."
Many thanks for any suggestion!
댓글 수: 2
Geoff Hayes
2022년 7월 14일
@Roberto Revelli - perhaps you need to pause on each iteration of the loop to give the app time to draw the line...rather than trying to draw each line one after the other. I'm just guessing here as I don't have the Mapping Toolbox to reproduce the behaviour.
답변 (1개)
Siraj
2023년 9월 15일
편집: Siraj
2023년 9월 15일
Hi!
It is my understanding that you want to draw multiple lines on a web map using the "wmline" function in MATLAB. However, when the number of lines becomes larger, the following error is encountered.
"The web map page has not finished loading."
I suspect that it is a memory issue. As the number of lines to be drawn on the web map increases, it consumes more memory and eventually leads to the error.
As a workaround you can put all the line coordinates into a “geoshape” and then use one call to “wmline”. This is significantly faster.
Refer to the provided code for a clearer understanding and feel free to modify it according to your specific requirements. In this example, the code draws 500 circles on a web map.
% Define the center coordinates
lat0 = 51.50487;
lon0 = 0.05235;
% Open the web map using OpenStreetMap as the base map
webmap('OpenStreetMap')
% Initialize an empty array to store azimuth values
az = [];
% Define the reference ellipsoid
e = wgs84Ellipsoid;
% Start measuring the execution time
tic
% Loop to create circles with increasing radii
for i = 1:500
% Calculate the radius based on the loop index
radius = 10 * i;
% Calculate the latitude and longitude coordinates of the circle
[lat, lon] = scircle1(lat0, lon0, radius, az, e);
% Generate a name for the circle based on its radius
name = sprintf('%d Meters', radius);
% Create a geoshape object representing the circle
s(i) = geoshape(lat, lon, "Name", name);
end
% Draw all the circles as a single line on the web map
wmline(s, 'Color', 'k', 'OverlayName', '1:500 lines (meters)')
% Stop measuring the execution time and display it
toc
For more detailed information about the "geoshape" object and the "wmline" function, you can refer to the following links:
These resources provide comprehensive explanations and usage examples for the "geoshape" object and the "wmline" function in MATLAB.
Hope this helps.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!