Computing the dimensions of a geographical area

조회 수: 2 (최근 30일)
Maurilio Matracia
Maurilio Matracia 2021년 2월 15일
답변: Avni Agrawal 2024년 5월 14일
Hi everyone,
I am trying to compute the dimensions of the rectangle (or Cell) shown in blue in the map, which has been generated by geodensityplot according to the values of LatP, LonP, and respective weights.
As you can see from the figure, I tried to compute the width and the height of the rectangle with two methods:
1. I considered the average latitude/longitude and I chose the points with the maximum and minimum longitude/latitude to compute the distance and convert it in meters.
2. I simply computed the lengths of the arcs covered by the rectangle as arcLon=max(LonP)-min(LonP) and arcLat=max(LatP)-min(LatP) and computed the average distance spanned by those arcs.
My concern is that both the methods (especially the first one, that should be more accurate) are providing weird results. Indeed, from the map it is evident that the width should be around 5300 m and the height around 6200 m.
Thank you in advance for your help!
  댓글 수: 4
darova
darova 2021년 2월 16일
What are colsU and rowsU?
Maurilio Matracia
Maurilio Matracia 2021년 2월 16일
sorry, they're actually the number of rows or columns to further divide the cell in subcells...
In the initial question I assumed them equal to 1 so that we just have the full rectangle, you can do the same

댓글을 달려면 로그인하십시오.

답변 (1개)

Avni Agrawal
Avni Agrawal 2024년 5월 14일
I understand that you are trying to compute the dimensions of geographic area.Certainly, let's simplify and correct your approach to calculating the dimensions of cells in a geodensity plot based on latitude and longitude data.
Method 1: Distance Calculation
You're calculating the distance across latitudes and longitudes to find the dimensions of the entire area covered by your data, then dividing by the number of cells to find each cell's dimensions. Ensure you're using the `distance` function correctly with latitude and longitude values.
widthCell = 1000 * deg2km(distance(mean(latP), min(lonP), mean(latP), max(lonP))) / colsU;
heightCell = 1000 * deg2km(distance(min(latP), mean(lonP), max(latP), mean(lonP))) / rowsU;
Method 2: Arc Length Calculation
This method calculates the arc lengths from the latitude and longitude differences directly and converts these spans into distances.
widthCell = 1000 * deg2km(arcLon) / colsU;
heightCell = 1000 * deg2km(arcLat) / rowsU;
- Ensure accurate use of `distance` and `deg2km` functions.
- Verify the number of cells (`colsU` and `rowsU`) matches the divisions in your geodensity plot.
- Remember, calculations assume the Earth is a perfect sphere, which might introduce some errors, especially at high latitudes or over large distances.
I hope this helps!

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by