Convert a point in maps.me-mercator CS to WGS-84 (EPSG:4326).
(coord_size: int, point: mi.Point)
| 318 | |
| 319 | |
| 320 | def to_4326(coord_size: int, point: mi.Point) -> mi.Point: |
| 321 | """Convert a point in maps.me-mercator CS to WGS-84 (EPSG:4326).""" |
| 322 | merc_bounds = (-180.0, -180.0, 180.0, 180.0) # Xmin, Ymin, Xmax, Ymax |
| 323 | x = point.x * (merc_bounds[2] - merc_bounds[0]) / coord_size + merc_bounds[0] |
| 324 | y = point.y * (merc_bounds[3] - merc_bounds[1]) / coord_size + merc_bounds[1] |
| 325 | y = 360.0 * math.atan(math.tanh(y * math.pi / 360.0)) / math.pi |
| 326 | return mi.Point(x, y) |
| 327 | |
| 328 | |
| 329 | def read_coord( |
no test coverage detected