Geometry

class gpp.geometry.Coordinate(lng: float, lat: float)[source]

Bases: object

지리좌표계 / 단위: degree

Variables:
  • lng – 경도 (-180 <= 경도 <= 180)

  • lat – 위도 (-85 <= 위도 <= 85)

lat: float
lng: float
class gpp.geometry.ProjectedCoordinate(x, y)[source]

Bases: object

메르카토르 도법에 의해 투영(projection)된 및 0 ~ 1로 scale된 xy 평면 좌표

(0,0)
  +--------------------------+
  |                          |
  |                          |
  |                          |
  |                          |
  +--------------------------+ (1,1)
Variables:
  • x – 0 <= x <= 1

  • y – 0 <= y <= 1

x: float
y: float
class gpp.geometry.Tile(x_index: int, y_index: int, zoom_level: int)[source]

Bases: object

ProjectedCoordinate 객체를 zoom level에 따라 tile index로 표현

example for zoom level = 1

+------------+-------------+
|(0,0)       |(1,0)        |
|            |             |
+------------+-------------+
|(0,1)       |(1,1)        |
|            |             |
+------------+-------------+
Variables:
  • x – 0 <= x index < 2^z

  • y – 0 <= y index < 2^z

  • z – zoom level

x: int
y: int
z: int
gpp.geometry.coord_to_proj_coord(coord: Coordinate) ProjectedCoordinate[source]

위경도 좌표 범위를 Point로 변환

Parameters:

coord (Coordinate) – 위경도

Returns:

ProjectedCoordinate instance

Return type:

ProjectedCoordinate

gpp.geometry.distance(p1: Coordinate, p2: Coordinate) float[source]

하버 사인 (haversine) 공식을 이용하여 두 점 사이의 곡선에 따른 표면 거리(단위: m)를 구합니다.

Parameters:
Returns:

distance in meter

Return type:

float

gpp.geometry.proj_coord_to_coord(proj_coord: ProjectedCoordinate) Coordinate[source]

Point를 위경도 좌표 범위로 변환

Parameters:

proj_coord (ProjectedCoordinate) – projected & converted coordinate

Returns:

Coordinate Instance

Return type:

Coordinate

gpp.geometry.proj_coord_to_tile(proj_coord: ProjectedCoordinate, zoom_level: int) Tile[source]

ProjectedCoordinate를 Tile로 변환

Parameters:
Returns:

Tile Instance

Return type:

Tile

gpp.geometry.tile_to_proj_coord(tile: Tile) ProjectedCoordinate[source]

Tile을 ProjectedCoordinate로 변환

Parameters:

tile (Tile) – Tile instance

Returns:

ProjectedCoordinate Instance

Return type:

ProjectedCoordinate