How to fix the "Error downloading URL" in MATLAB when increasing the range and include mountain and foliage details in the generated scenario?

3 visualizzazioni (ultimi 30 giorni)
p = inputParser;
validScalarNum = @(x) isnumeric(x) && isscalar(x);
validScalarPosNum = @(x) isnumeric(x) && isscalar(x) && (x > 0);
addOptional(p,'Latitude',35.286417, validScalarNum) % NU campus location as default
addOptional(p,'Longitude',75.61963, validScalarNum)
addOptional(p,'Range',10000, validScalarPosNum) % 50000 meters range as default
addParameter(p,'osmFileName', 'scenario.osm', @ischar)
parse(p,varargin{:});
scenarioLat = p.Results.Latitude;
scenarioLon = p.Results.Longitude;
range = p.Results.Range;
scenarioFileName = p.Results.osmFileName;
% Convert input distance to earth degrees (Lat, Lon are given in degrees)
distUnits = 'm';
arclen = rad2deg(range/earthRadius(distUnits));
[lat1,~] = reckon(scenarioLat, scenarioLon,arclen,0);
[lat2,~] = reckon(scenarioLat, scenarioLon,arclen,180);
[~,lon1] = reckon(scenarioLat, scenarioLon,arclen,90);
[~,lon2] = reckon(scenarioLat, scenarioLon,arclen,270);
url = sprintf('https://www.openstreetmap.org/api/0.6/map?bbox=%0.4f%%2C%0.4f%%2C%0.4f%%2C%0.4f',lon2,lat2,lon1,lat1);
urlwrite(url,scenarioFileName);
end
when i increased the range from 5000, i can,t download the scenerio and how i can add information like mounatins and foliage in this scenerio?

Risposte (2)

Hassaan
Hassaan il 1 Gen 2024
The "Error downloading URL" you're experiencing in MATLAB when increasing the range for your OpenStreetMap (OSM) query likely stems from the fact that larger ranges result in requests for more data. OSM has limits on the size of the area you can download in a single query to prevent overloading their servers. When you exceed these limits, the server may refuse your request, resulting in an error
  1. Check API Limits: Verify the maximum allowed area for a single download request on the OSM API documentation. Ensure your range variable does not exceed this limit.
  2. Error Handling: Implement error handling in your script to catch and understand the errors. Modify the urlwrite line to something like this:
try
urlwrite(url, scenarioFileName);
catch exception
disp('Error downloading URL:');
disp(getReport(exception));
end
Reduce Range: If the range is too large, consider downloading the data in smaller sections and then combining them.
Efficient Requests: If you frequently need to download large areas, consider setting up a local OSM server or using a commercial OSM service that allows for larger requests.
Include Topographical Details: OSM primarily provides street maps and may not have the level of detail you need for mountains and foliage. For such details, you might need to integrate data from other sources like the USGS Earth Explorer or NASA's SRTM data. These sources provide topographical data which can give you information about elevation and terrain.
Data Processing: Once you have the topographical data, you will need to process it to integrate with your OSM data. This might involve converting data formats, aligning coordinate systems, and interpolating data to match the resolutions.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems
  • Electrical and Electronics Engineering

Shujaa
Shujaa il 8 Gen 2024

Categorie

Scopri di più su Downloads in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by