MCPcopy Create free account
hub / github.com/comaps/comaps / to_4326

Function to_4326

tools/python/mwm/mwm_python.py:320–326  ·  view source on GitHub ↗

Convert a point in maps.me-mercator CS to WGS-84 (EPSG:4326).

(coord_size: int, point: mi.Point)

Source from the content-addressed store, hash-verified

318
319
320def 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
329def read_coord(

Callers 2

read_coordFunction · 0.85
read_boundsFunction · 0.85

Calls 1

PointMethod · 0.45

Tested by

no test coverage detected