Преобразование координат массива точек в метрах (проекции) в координаты градусной меры.
#include <gis/gis_math.h>int gis_helper_convert_point_meters_2_degrees_array( gis_helper_math_ctx_t math_ctx, double_point_t *out_degrees, uint32_t n_points );
gishelper
Функция используется для преобразования координат из метров в градусы.
gis_helper_math_ctx_t math_ctx;gis_helper_math_init_ctx( &math_ctx );gis_map_projection_t projection;gis_map_projection_init( &projection );projection.EPSG = 3857;gis_helper_math_generate_meters_projection( math_ctx, &projection );double_point_t points[3];points[0].x = 3000;points[0].y = 3000;points[1].x = 4000;points[1].y = 4000;points[2].x = 5000;points[2].y = 5000;if ( gis_helper_convert_point_meters_2_degrees_array( math_ctx, &points[0], 3 ) != EOK ) {printf( "Conversion failed" );return 1;}if (( fabs( points[0].x - 0.026949 ) < 0.0001 && fabs( points[0].y - 0.026949 ) < 0.0001 ) &&( fabs( points[1].x - 0.035933 ) < 0.0001 && fabs( points[1].y - 0.035933 ) < 0.0001 ) &&( fabs( points[2].x - 0.044916 ) < 0.0001 && fabs( points[2].y - 0.044916 ) < 0.0001 )){printf( "Correct" );}else{printf( "Incorrect degree coordinates: %lf %lf", points[0].x, points[0].y );printf( "Incorrect degree coordinates: %lf %lf", points[1].x, points[1].y );printf( "Incorrect degree coordinates: %lf %lf", points[2].x, points[2].y );return 1;}
ПК ЦКИ для ЗОСРВ «Нейтрино»
gis_helper_math_ctx_t, gis_helper_convert_point_degrees_2_meters()
Предыдущий раздел: Описание API картографического фреймворка