How to convert latitude and longitude of location to cartesian coordinates (x, y)?
31 views (last 30 days)
Chunru on 15 Aug 2022
First, you need a reference point. Second you have to assume that the posints are close enough to the reference points so that the spherical coordinates on earth surface (lat, lon) can be approximate in cartesian coordinates.
With these assumption, you can do the following:
ref = [27, 77]; % ref point [lat, lon]
p = [27.2046, 77.4977];
[arclen az] = distance(ref, p)
x = deg2km(arclen.*cosd(az));
y = deg2km(arclen.*sind(az));