25 views (last 30 days)
Show older comments
Bradley on 16 May 2024 at 15:28
-
-
Link
Direct link to this question
https://www.mathworks.com/matlabcentral/answers/2119566-how-to-plot-a-object-with-distance-in-meters-on-a-map-with-lat-and-long-unit
Commented: Taylor on 16 May 2024 at 20:32
Open in MATLAB Online
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 Show -2 older commentsHide -2 older comments
Show -2 older commentsHide -2 older comments
Sign in to comment.
Sign in to answer this question.
Answers (1)
Taylor on 16 May 2024 at 15:55
I think what you're looking for is the "Plot Shapes in Projected Coordinates" example here
3 Comments Show 1 older commentHide 1 older comment
Show 1 older commentHide 1 older comment
Bradley on 16 May 2024 at 16:33
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2119566-how-to-plot-a-object-with-distance-in-meters-on-a-map-with-lat-and-long-unit#comment_3163496
I created a polyshape out of the section of the circle I want to plot, I didnt have any issue plotting the shape. The issue im running into is determining distance from the arc to the starting point. In real life that range is 25 meters, when I put range at 25, MATLAB thinks thats in degrees and so it plots a massive shape. Im not sure how to go about plotting this as its in meters and not degrees. Is there a way to convert the units of my geoaxes map to UTM? I assume that would be easier than converting meter length to degree length. Thanks agian.
Taylor on 16 May 2024 at 19:28
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2119566-how-to-plot-a-object-with-distance-in-meters-on-a-map-with-lat-and-long-unit#comment_3163701
This function on File Exchange should convert your lat/long coordinates to UTM coordinates.
Taylor on 16 May 2024 at 20:32
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2119566-how-to-plot-a-object-with-distance-in-meters-on-a-map-with-lat-and-long-unit#comment_3163731
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.
Sign in to comment.
Sign in to answer this question.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contact your local office