A Geospatial Python Package for Field Researchers
Project description
A Geospatial Python Package for Field Researchers
Owlet and EGF: Developed for Field Researchers
Owlet is a Python library for interacting with and mapping EGF files.
EGF, or Exact Geometry Format, is a file structure designed specifically for recording geo-data without traditional GIS software. An EGF file contains all of the necessary components required to define geospatial features— without overcomplicating it.
EGF File Example
Overview
An EGF file is comprised of three sections:
- A Feature Type Declaration (point, line, polygon)
- Attribute Headers
- Features: attributes & coordinate sets
Example EFG file of two placemarks:
PT
Park Name, City, Pond, Fountain
Post office Square, Boston, FALSE, TRUE
42.356243, -71.055631, 2
Boston Common, Boston, TRUE, TRUE
42.355465, -71.066412, 10
In an EGF file, each section / feature is separated by three blank lines and the file ends with a single blank line.
An EGF file is a '.txt' file renamed to '.egf'
How to Use Owlet
Install
Windows
>>> py -m pip install owlet
MacOS / Linux
>>> python3 pip install owlet
Reading an EGF file
import owlet
file_path = r"path/to/file/PostOfficeSquare.egf"
my_shape = owlet.egf_read(file_path)
Converting EGF file to Other Formats
CSV
csv = my_shape.table()
GeoJSON
json = my_shape.geo_json()
EGF
egf = my_shape.egf()
Owlet in Use
Owlet Code Snippets
Visualizing an EGF
import owlet
# File path of EGF file
file_path = r"path/to/file/PostOfficeSquare.egf"
# Loading EGF into Owlet
my_shape = owlet.egf_read(file_path)
# Opening a preview with http://geojson.io
my_shape.geo_json(visualize=True)
Writing a GeoJSON file for use with GIS software
import owlet
# File path of EGF file
file_path = r"path/to/file/PostOfficeSquare.egf"
# Loading EGF into Owlet
my_shape = owlet.egf_read(file_path)
# Saving GeoJSON to a variable
json = my_shape.geo_json()
# Full path of file to create- including file extension ".json"
json_path = r"path/to/file/PostOfficeSquare.json"
# Writing GeoJSON to file
owlet.text_writer(json_path, json)
Converting EGF file to CSV for external filtering / manipulation
import owlet
# File path of EGF file
file_path = r"path/to/file/PostOfficeSquare.egf"
# Loading EGF into Owlet
my_shape = owlet.egf_read(file_path)
# Converting EGF into a table that can be wrtten to a '.csv' file
csv_data = myshape.table()
# Full path of file to create- including file extension ".csv"
csv_path = r"path/to/file/PostOfficeSquare.csv"
# Writing table to file
owlet.write_csv(csv_path, csv_data)
Loading CSV back into Owlet
# Full path of file to read
csv_path = r"path/to/file/PostOfficeSquare.csv"
geom_type = 'PT' # Tells Owlet what type of feature to expect when reading csv
# Loading csv into Owlet
owlet.from_csv(geom_type, csv_path)
Owlet License: GNU GPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
owlet-0.6.0.tar.gz
(11.8 kB
view hashes)
Built Distribution
owlet-0.6.0-py3-none-any.whl
(13.5 kB
view hashes)