how to plot a object with distance in meters on a map with lat and long unit?
12 views (last 30 days)
Show older comments
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:
0 Comments
Answers (1)
Taylor
on 16 May 2024
I think what you're looking for is the "Plot Shapes in Projected Coordinates" example here
3 Comments
Taylor
on 16 May 2024
This function on File Exchange should convert your lat/long coordinates to UTM coordinates.
Taylor
on 16 May 2024
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.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!