I have some coordinates from the ISS (International Space Station) and I'd like to know whether when the coordinates were recorded the ISS was over land or ocean and I should do this offline, but I'm not sure what approach to use. A part from python standard library, I'm restricted to only using these libraries:
numpy
scipy
tensorflow
pandas
opencv-python
opencv-contrib-python
evdev
matplotlib
logzero
pyephem
scikit-image
scikit-learn
reverse-geocoder
If you know how to do this using some other libraries though, it'd be good anyway.
With this code I get the coordinates and write them to a file:
import logging
import logzero
from logzero import logger
import os
import ephem
import time
dir_path = os.path.dirname(os.path.realpath(__file__))
logzero.logfile(dir_path+"/coordinates.csv")
# Set a custom formatter
formatter = logging.Formatter('%(name)s - %(asctime)-15s - %(levelname)s: %(message)s');
logzero.formatter(formatter)
name = "ISS (ZARYA)"
line1 = "1 25544U 98067A 18282.18499736 .00001222 00000-0 25998-4 0 9992"
line2 = "2 25544 51.6418 170.6260 0003545 261.4423 234.4561 15.53790940136242"
iss = ephem.readtle(name, line1, line2)
iss.compute()
latitude = iss.sublat
longitude = iss.sublong
# Save the data to the file
logger.info("%s,%s", latitude, longitude )
Do you guys have any idea? Thanks in advance.
global-land-mask
from Karin Todd is extremely easy to use and efficient:
from global_land_mask import globe
print(globe.is_land(49.22, -2.23))
# → True
print(globe.is_land(49.22, -2.25))
# → False
It is available via pip
, and its only dependency is numpy
.
mpl_toolkits.basemap
may be able to help.
from mpl_toolkits.basemap import Basemap
bm = Basemap() # default: projection='cyl'
print(bm.is_land(99.0, 13.0)) #True
print(bm.is_land(0.0, 0.0)) # False
Docs: here and relevant method below:
is_land(xpt, ypt) Returns True if the given x,y point (in projection coordinates) is over land, False otherwise. The definition of land is based upon the GSHHS coastline polygons associated with the class instance. Points over lakes inside land regions are not counted as land points.
Note: you may need to be careful with the projection that is being used with the Basemap object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With