how to plot a object with distance in meters on a map with lat and ... (2024)

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

  • 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:

how to plot a object with distance in meters on a map with lat and ... (2)

0 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

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2119566-how-to-plot-a-object-with-distance-in-meters-on-a-map-with-lat-and-long-unit#answer_1459031

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2119566-how-to-plot-a-object-with-distance-in-meters-on-a-map-with-lat-and-long-unit#answer_1459031

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

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

  • Link

    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

  • Link

    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

  • Link

    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.

See Also

Tags

  • geoaxes

Products

  • MATLAB

Release

R2023b

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


how to plot a object with distance in meters on a map with lat and ... (7)

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)

Europe

  • 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

Contact your local office

how to plot a object with distance in meters on a map with lat and ... (2024)

References

Top Articles
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 6455

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.