toddkarin / global-land-mask Goto Github PK
View Code? Open in Web Editor NEWCheck whether a lat/lon point is on land for any point on earth
License: MIT License
Check whether a lat/lon point is on land for any point on earth
License: MIT License
The numpy requirement, although documented, is missing from the install_requires
field in setup.py (which is missing in general). It would be great if we had it, so that pip installs it automatically.
Hey guy's
Caspian sea seems recorded as being a land and not a sea, how could it be modified ?
lat = 40.44435
lon = 50.61982
Many thanks
On replit.com, using global land mask does not work. It shows this error when starting the project
File "main.py", line 5, in <module>
import image
File "/home/runner/mapple-1/image.py", line 1, in <module>
from global_land_mask import globe
File "/home/runner/mapple-1/venv/lib/python3.8/site-packages/global_land_mask/__init__.py", line 3, in <module>
from .globe import *
File "/home/runner/mapple-1/venv/lib/python3.8/site-packages/global_land_mask/globe.py", line 26, in <module>
_mask_fid = np.load(_mask_filename)
File "/home/runner/mapple-1/venv/lib/python3.8/site-packages/numpy/lib/npyio.py", line 407, in load
fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/.cache/pip/pool/bc/6d/73/globe_combined_mask_compressed.npz'```
In one of the first lines of the globe.py
file a malicious compressed file called globe_combined_mask_compressed.npz
is loaded in path.
It is responsible for loading the file into memory.
_mask_filename = os.path.join(_path,'globe_combined_mask_compressed.npz')
_mask_fid = np.load(_mask_filename)
I found it strange a coordinate calculation using a hidden library, and decided to pass the file in the VirusTotal website. This library when executed is malicious and contains malware.
HERE IS the link
Wikimedia "Mercator Projection" vs Global Land Mask (green & red). Green means an antipode with land on both sides.
I believe my x,y to lat, long coordinate conversion is accurate +/- <1 degree, feel free to check it out yourself:
import numpy as np;
import math;
def XYToLatLong(x,y):
longitude = (x/(mapWidth/360))-180;
mercN = ((-y + (mapHeight/2))*(2*math.pi))/mapWidth;
latRad = 2*(np.arctan(np.exp(mercN))-(math.pi/4));
latitude = latRad/(math.pi/180);
return latitude,longitude
Hi,
just a feedback to suggest that it's more natural to use f(lon, lat) given that longitude (latitude) values refer to x (y) coordinates on a map,
so calling f(lon, lat) it's equivalent to f(x,y).
It would be really useful going forward if commands such as:
from global_land_mask import globe
globe.is_land(lat,lon)
would take masked arrays or ignore nan values
is there a mask out there for global inland lakes? this would be a useful feature as well.
I'm trying to run your package on a Raspberry Pi Zero and I'm running into memory issues.
Traceback (most recent call last):
File "grid-nn.py", line 7, in <module>
from global_land_mask import globe
File "/home/pi/.local/lib/python3.7/site-packages/global_land_mask/__init__.py", line 3, in <module>
from .globe import *
File "/home/pi/.local/lib/python3.7/site-packages/global_land_mask/globe.py", line 28, in <module>
_mask = _mask_fid['mask']
File "/home/pi/.local/lib/python3.7/site-packages/numpy/lib/npyio.py", line 256, in __getitem__
pickle_kwargs=self.pickle_kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/numpy/lib/format.py", line 770, in read_array
array = numpy.ndarray(count, dtype=dtype)
numpy.core._exceptions.MemoryError: Unable to allocate 890. MiB for an array with shape (933120000,) and data type bool
Is there any way for this package to only load parts of the globe or otherwise reduce the required memory? I'm only interested in a specific "rectangle" on the globe.
This coordinates (lat: -3.730884, lon: -38.457926) were
accused of being in the ocean
https://www.google.com/maps/place/3°43'51.2"S+38°27'28.5"W/@-3.7308889,-38.4601054,17z/data=!3m1!4b1!4m5!3m4!1s0x0:0x0!8m2!3d-3.730884!4d-38.457926?hl=pt
lat = -3.730884
lon = -38.457926
is_on_land = globe.is_land(lat, lon)
is_in_ocean = globe.is_ocean(lat, lon)
print(f"is_on_land: {is_on_land}")
print(f"is_in_ocean: {is_in_ocean}")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.