Convert to an X Y coordinate System

32 次查看(过去 30 天)
I have seen that geographical coordinates in (latitude, longitude) format can be converted to XY coordinates using Mathlab equal area function [x,y]=grn2equ(lat, lon)
Is there a similar function that converts lat, lon coordinates to equal distance xy coordinate system?
(Basically what I want to do is to convert a set of points (lat, lon)to plane X y coordinates and do some distance calculations on them. Further, these lat, lon coordinates refers to WGS84)

采纳的回答

Rob Graessle
Rob Graessle 2022-6-6
编辑:MathWorks Support Team 2022-6-6
You can use projfwd to convert latitude-longitude coordinates to x and y map coordinates in a projected coordinate reference system (CRS) returned by projcrs. Any projected CRS introduces distortions compared to maps on a globe, and as a result there is no CRS which will enable you to perfectly maintain distance calculations between the globe and x,y map coordinates. However, if you are working in a small region you can choose an appropriate projected CRS designed for that region which minimizes distortion and can approximate actual distances on the globe (ellipsoid). As an example, the code below computes the globe-based geodesic distance between two points in Massachusetts and compares it to the equivalent distance computed in x,y coordinates for two projected Coordinate Reference Systems. The computed distances match well.
>> % Define points in Natick and Boston
>> latNatick = 42.3001;
>> lonNatick = -71.3504;
>> latBoston = 42.3467;
>> lonBoston = -71.0972;
>> % Compute geodesic distance in km on ellipsoid
>> d = distance(latNatick,lonNatick,latBoston,lonBoston,wgs84Ellipsoid)/1000
d =
21.5036
>> % Convert coordinates to x/y in UTM projection and compute Cartesian
>> % distance in km between points
>> pUTM = projcrs(32619)
pUTM =
projcrs with properties:
Name: "WGS 84 / UTM zone 19N"
GeographicCRS: [1×1 geocrs]
ProjectionMethod: "Transverse Mercator"
LengthUnit: "meter"
ProjectionParameters: [1×1 map.crs.ProjectionParameters]
>> [xNatick,yNatick] = projfwd(pUTM, latNatick,lonNatick);
>> [xBoston, yBoston] = projfwd(pUTM, latBoston,lonBoston);
>> dUTM = hypot(xNatick-xBoston, yNatick-yBoston)/1000
dUTM =
21.5039
>> % Convert coordinates to x/y in MA State projection and compute Cartesian
>> % distance in km between points
>> pMA = projcrs(2249)
pMA =
projcrs with properties:
Name: "NAD83 / Massachusetts Mainland (ftUS)"
GeographicCRS: [1×1 geocrs]
ProjectionMethod: "Lambert Conic Conformal (2SP)"
LengthUnit: "U.S. survey foot"
ProjectionParameters: [1×1 map.crs.ProjectionParameters]
>> [xNatick,yNatick] = projfwd(pMA, latNatick,lonNatick);
>> [xBoston, yBoston] = projfwd(pMA, latBoston,lonBoston);
>> dMAFeet = hypot(xNatick-xBoston, yNatick-yBoston);
>> mPerFoot = unitsratio("meter","feet");
>> dMA = dMAFeet*mPerFoot/1000
dMA =
21.5028
Previous response from 2011: This File Exchange submission may help: Spherical to Azimuthal Equidistant
  4 个评论

请先登录,再进行评论。

更多回答(1 个)

uma
uma 2018-6-4
can you help me, Is it possible to covert vice-versa situation like x, y to decimal latlong

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by