diff --git a/src/marshconnector.cpp b/src/marshconnector.cpp index d43e511..591cf11 100644 --- a/src/marshconnector.cpp +++ b/src/marshconnector.cpp @@ -282,6 +282,10 @@ Vector2 MarshConnector::local_meters_from_global_degrees(double latitude, // Y East is just length along the circle of latitude double y = (lon - lon0) * (EARTH_RADIUS * cos(lat0)); + const double map_size = 3000.0; + x = (Math::fract(x / map_size + 0.5) - 0.5) * map_size; + y = (Math::fract(y / map_size + 0.5) - 0.5) * map_size; + return Vector2(x, y); } void MarshConnector::handle_sim_state(mavlink_message_t message) {