-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,6 @@ services: | |
ports: | ||
- "8080:8080" | ||
volumes: | ||
- .:/usr/src/app | ||
- .:/usr/src/app:nocopy | ||
depends_on: | ||
- mongo |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import math | ||
|
||
|
||
def mercator_tile_by_coords(lat_deg, lon_deg, level): | ||
""" | ||
epsg3857 | ||
:param lat_deg: | ||
:param lon_deg: | ||
:param level: | ||
:return: | ||
""" | ||
lat_rad = math.radians(lat_deg) | ||
zoom = 2.0 ** level | ||
xtile = int((lon_deg + 180.0) / 360.0 * zoom) | ||
ytile = int((1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * zoom) | ||
return { | ||
'x': xtile, | ||
'y': ytile, | ||
} | ||
|
||
|
||
def wgs84_tile_by_coors(lat, long, level): | ||
""" | ||
epsg4326 | ||
actually here should be 180 but.... | ||
For GIBS GCS, the level 0 resolution is 288 deg / tile, not 180 deg/tile. | ||
It was chosen to approximate the full resolution of the MODIS images, | ||
avoiding oversampling or undersampling, while still having full width | ||
tiles at most levels (2 and up). | ||
more is here <https://github.com/nasa-gibs/onearth/issues/53#issuecomment-299738858> | ||
:param lat: | ||
:param long: | ||
:param level: | ||
:return: | ||
""" | ||
magic_number = 1 / 288 | ||
zoom = 2 ** level | ||
return { | ||
'x': int((90 - lat) * zoom * magic_number), | ||
'y': int((180 + long) * zoom * magic_number), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ pytest-asyncio==0.5.0 | |
pytest-catchlog==1.2.2 | ||
pytest-cov==2.4.0 | ||
pytest-mock==1.6.0 | ||
python-slugify==1.2.4 |