π‘ λ³Έ λ¬Έμλ 'ROS GPS(WGS84) to UTM μ’ν λ³ννκΈ°'μ λν΄ μ 리ν΄λμ κΈμ λλ€.
GPS(WGS84), UTM μ’νκ³ μ체μ λν μ΄ν΄λΆν° μ΄λ₯Ό λ³ννλ λΌμ΄λΈλ¬λ¦¬ μ¬μ©λ°©λ²κΉμ§ μ 리νμμΌλ μ°Έκ³ νμκΈ° λ°λλλ€.
1. μ’νκ³ μ΄ν΄
1) GPS(WGS84)
WGSλ World Gedetic System coordinateμ μ½μ΄μ΄λ©°, WGS84 μ’νκ³μμ 84λ 84λ λμ μ μ λ μ’νκ³μ λλ€.
μ΄λ νμ체 λͺ¨μμ μ§κ΅¬μ μμΉλ₯Ό νννκΈ° μν μ’νκ³λ‘, μ λμ λ³Έμ΄μμ€μ μ΄ κ΅μ°¨νλ μ μ κΈ°μ€μ (0.0º, 0.0º)μΌλ‘ ν©λλ€.
λ°λΌμ νν μ체λ μ ννλ, νμ체 μ체μμμ μμΉλ₯Ό νννκΈ°μ λ©΄μ 거리λ₯Ό κ³μ°νλ λ° μ΄λ €μμ κ²ͺμ μ μμ΅λλ€.
2) UTM
UTM μ’νκ³λ Universal Transverse Mercator Coordinate Systemμ μ½μ΄μ λλ€.
μ΄λ λλ©΄ μμ μ§κ΅¬λ₯Ό λκ² ν΄μ νμνλ€κ³ μκ°νλ©΄ μ΄ν΄νκΈ° μ¬μ°λ©°, μ ννλ 3λλ₯Ό κΈ°μ€μΌλ‘ μ§κ΅¬λ₯Ό 60μ‘°κ°μΌλ‘ λλ ν κ° λ¨λ©΄ νΌμ³ μ§μ¬κ°ν ννλ‘ λ§λ λ€κ³ μκ°νλ©΄ λ©λλ€.
λ°λΌμ μνμ ν΄λ λ°©μμ΄λ€ 보λ μκ³‘μ΄ μ‘΄μ¬ν©λλ€λ§, λ©΄μ 거리λ₯Ό κ³μ°νλ λ° μ©μ΄ν©λλ€.
2. μ’ν λ³ννκΈ°(WGS84 <=> UTM)
1) Python (library: utm)
utm λΌμ΄λΈλ¬λ¦¬λ 'Bidirectional UTM-WGS84 converter for python'μ΄λΌ μ€λͺ λμ΄ μμΌλ©°, μλ°©ν₯μΌλ‘ λ³ννλ νμ΄μ¬ λΌμ΄λΈλ¬λ¦¬μ λλ€. λ€μκ³Ό κ°μ΄ μ€μΉν΄μ μ¬μ©ν μ μμ΅λλ€.
$ pip install utm
Usage
>>> import utm
Latitude/Longitude to UTM
Convert a (latitude, longitude) tuple into an UTM coordinate:
>>> utm.from_latlon(51.2, 7.5)
(395201.3103811303, 5673135.241182375, 32, 'U')
- The syntax is utm.from_latlon(LATITUDE, LONGITUDE).
- The return has the form (EASTING, NORTHING, ZONE_NUMBER, ZONE_LETTER).
You can also use NumPy arrays for LATITUDE and LONGITUDE. In the result EASTING and NORTHING will have the same shape. ZONE_NUMBER and ZONE_LETTER are scalars and will be calculated for the first point of the input. All other points will be set into the same UTM zone. Therefore it's a good idea to make sure all points are near each other.
>>> utm.from_latlon(np.array([51.2, 49.0]), np.array([7.5, 8.4]))
(array([395201.31038113, 456114.59586214]), array([5673135.24118237, 5427629.20426126]), 32, 'U')
UTM to Latitude/Longitude Convert an UTM coordinate into a (latitude, longitude) tuple:
>>> utm.to_latlon(340000, 5710000, 32, 'U')
(51.51852098408468, 6.693872395145327)
- The syntax is utm.to_latlon(EASTING, NORTHING, ZONE_NUMBER, ZONE_LETTER).
- The return has the form (LATITUDE, LONGITUDE).
You can also use NumPy arrays for EASTING and NORTHING. In the result LATITUDE and LONGITUDE will have the same shape. ZONE_NUMBER and ZONE_LETTER are scalars.
>>> utm.to_latlon(np.array([395200, 456100]), np.array([5673100, 5427600]), 32, 'U')
(array([51.19968297, 48.99973627]), array([7.49999141, 8.3998036 ]))
Since the zone letter is not strictly needed for the conversion you may also the northern parameter instead, which is a named parameter and can be set to either True or False. Have a look at the unit tests to see how it can be used.
2) C++ (library: GeographicLib)
1. λΌμ΄λΈλ¬λ¦¬ μ€μΉ λ° PATH λ±λ‘
Installation using the autoconfigure tools. The method works on most Unix-like systems including Linux and Mac OS X. Here are the steps to compile and install GeographicLib:
Unpack the source, running
$ tar xfpz GeographicLib-1.44.tar.gz
then enter the directory created, Create a separate build directory and enter it.
cd GeographicLib-1.44
mkdir build
cd build
# Configure the software, specifying the path of the source directory, with
$ ../configure
# By default GeographicLib will be installed under /usr/local. You can change this with, for example
$ ../configure --prefix=/tmp/geographic
Compile and install the software with
make
make install
The headers, library, and utilities are installed in the include/GeographicLib, lib, and bin directories under prefix. For documentation, open share/doc/GeographicLib/html/index.html in a web browser.
2. CMakeLists νμΌ μμ
find_package(GeographicLib REQUIRED)
target_link_libraries ${GeographicLib_LIBRARIES}
3. μ½λ μμ±
void WGS2UTM(double lat, double lon, double& easting, double& northing){
int zone;
bool northp;
GeographicLib::UTMUPS::Forward(lat, lon, zone, northp, easting, northing);
std::string zonestr = GeographicLib::UTMUPS::EncodeZone(zone, northp);
}
μ°Έκ³
- [Github] utm: https://github.com/Turbo87/utm
- [Official] geographiclib: https://geographiclib.sourceforge.io/
- [Github] GeographicLib install: https://github.com/ObjSal/GeographicLib/blob/master/README.md
- [Blog] QGIS 곡λΆνκΈ° - WGS84, UTM, DMS, DD μ’νκ³ μ΄ν΄νκΈ°: https://grizzy-bear-blog.tistory.com/22