Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Python-based API for Electronic Navigational Charts (ENC)
This module follows the PEP8 convention for Python code.
First, ensure that you have the GDAL and GEOS libraries installed, as these are required in order to successfully install GDAL and Cartopy:
sudo apt-get install libgeos-dev libgdal-dev
From the root folder, one may then install an editable version of the package as follows:
pip install -e .
This should preferably be done inside a virtual environment in order to prevent Python packaging conflicts.
Install an edition of the Anaconda package manager, and then create a new conda environment with Python 3.11 or higher using e.g. the graphical user interface of PyCharm Professional as detailed here.
The required data processing libraries for spatial calculations and visualization may subsequently be installed simply by running the following commands in the terminal of your chosen environment:
conda install -c conda-forge fiona cartopy matplotlib
conda install matplotlib-scalebar cerberys pyyaml
First, ensure that Python 3.11 or higher is installed. Next, install all required packages using Pipwin:
python -m pip install --upgrade pip
pip install wheel
pip install pipwin
pipwin install numpy
pipwin install gdal
pipwin install fiona
pipwin install shapely
pip install cartopy
pip install pyyaml
pip install cerberus
pip install matplotlib-scalebar
Simply copy and paste the entire block above (including the empty line) into the terminal of your virtual environment, and go get a cup of coffee while it does its thing.
After the necessary dependencies have been correctly installed, the SeaCharts package may be installed directly through the Python Package Index (PyPI) by running the following command in the terminal:
pip install seacharts
or locally inside the SeaCharts root folder as an editable package with pip install -e .
This module supports reading and processing FGDB
files for sea depth data,
such as the Norwegian coastal data set used for demonstration purposes, found
here.
To visualize and access coastal data of Norway, follow the above link to download
the Depth data
(Sjøkart - Dybdedata
) dataset from the Norwegian Mapping Authority by adding
it to the Download queue and navigating to the separate
download page. Choose one or more
county areas (e.g. Møre og Romsdal
), and select the
EUREF89 UTM sone 33, 2d
(UTM zone 33N
) projection and FGDB 10.0
format. Finally, select your appropriate user group and purpose, and click
Download
to obtain the ZIP file(s).
Unpack the downloaded file(s) and place the extracted .gdb
in a suitable location,
in which the SeaCharts setup may be configured to search. The current
working directory as well as the relative data/
and data/db/
folders are
included by default.
The minimal example below imports the ENC
class from seacharts.enc
with the
default configuration found in seacharts/config.yaml
, and shows the interactive
SeaCharts display. Note that at least one database with spatial data (e.g. Møre og Romsdal
from the Norwegian Mapping Authority) is required.
if __name__ == '__main__':
from seacharts.enc import ENC
enc = ENC()
enc.display.show()
The config.yaml
file specifies which file paths to open and which area to load.
The corresponding config_schema.yaml
specifies how the required setup parameters
must be provided, using cerberus
.
After the spatial data is parsed into shapefiles during setup, geometric
shapes based on the Shapely library may be
accessed and manipulated through various ENC
attributes. The seacharts
feature layers are stored in seabed
, shore
and land
.
if __name__ == '__main__':
from seacharts.enc import ENC
# Values set in user-defined 'seacharts.yaml'
# size = 9000, 5062
# center = 44300, 6956450
enc = ENC("seacharts.yaml")
print(enc.seabed[10])
print(enc.shore)
print(enc.land)
enc.display.show()
Note how custom settings may be set in a user-defined .yaml-file, if its path is
provided to the ENC during initialization. One may also import and create an
instance of the seacharts.Config
dataclass, and provide it directly to the ENC.
The ENC.start_display
method is used to show a Matplotlib figure plot of the
loaded sea charts features. Zoom and pan the environment view using the mouse
scroll button, and holding and dragging the plot with left click, respectively.
Dark mode may be toggled using the d
key, and an optional colorbar showing
the various depth legends may be toggled using the c
key. Images of the
currently shown display may be saved in various resolutions by pressing
Control + s
, Shift + s
or s
.
This project uses the MIT license.
MIT License
Copyright (c) 2021 Simon Blindheim
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Electronic navigational charts (ENCs) processing & visualization
We found that seacharts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.