필터 지우기
필터 지우기

how to plot a object with distance in meters on a map with lat and long unit?

조회 수: 7 (최근 30일)
Bradley
Bradley 2024년 5월 16일
댓글: Taylor 2024년 5월 16일
Im using geoaxes to make a map, im also trying to plot a section of a circle on that map. The radius for the circle is in meters but the map is in degrees. When I plot the object on the map its huge, probably because the radius of 25 meters is being read as a radius of 25 degrees. Is there a way to convert the radius to degrees or convert my geoaxes units to UTM? I already tried convertting my lat and longs to UTM using ll2utm with no luck, I get an error saying my lat must be <= 90. an example of the map and the huge object, as well as the block of code I wrote are below. If anyone has any ideas that would be great, thanks!
figure
land = readgeotable("tl_2019_us_coastline.shp");
gx = geoaxes;
% gx.Parent = (fig);
gx.Position = [.40 .1 .55 .85];
geoplot(gx,land)
geoplot(gx,latN, lonN);
gx.TitleHorizontalAlignment = "center";
gx.Title.String = "All Mapped Surveys";
gx.Title.FontWeight = 'normal';
gx.Title.FontSize = 14;
hold on
center = [-117.1655687325801, 32.674622062384650];
rightAp = 65;
leftAp = 65;
radius = 24.9795;
heading = -1*(9.1999-90);
th = linspace(heading-leftAp, heading+rightAp, 100);
x = [center(2), sind(th) * radius + center(2), center(2)];
y = [center(1), cosd(th) * radius + center(1), center(1)];
geoplot(x, y, 'r-')
Here is an example of the map:

답변 (1개)

Taylor
Taylor 2024년 5월 16일
I think what you're looking for is the "Plot Shapes in Projected Coordinates" example here
  댓글 수: 3
Taylor
Taylor 2024년 5월 16일
This function on File Exchange should convert your lat/long coordinates to UTM coordinates.
Taylor
Taylor 2024년 5월 16일
After discussing with one of our Mapping developers, you have the option to work in meters and then adjust the necessary x- and y-offsets to align with your chosen projected CRS. Subsequently, utilize projinv to convert these to latitude-longitude coordinates for use in geoplot. Finding the appropriate offsets might be straightforward if you begin by using your central point in projfwd, follow up with the desired mathematical adjustments in meters, and finally, transform the results back using projinv. Alternatively, you can pinpoint the location by starting with the initial point and projfwd as previously mentioned, but then choose to depict your survey regions using a mappolyshape or maplineshape. By setting the projcrs, which is used in projfwd, as the ProjectedCRS attribute for the shape object, geoplot will manage the necessary subsequent transformations for the shape object.

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

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by