Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Latest commit

 

History

History
138 lines (107 loc) · 5.27 KB

README.md

File metadata and controls

138 lines (107 loc) · 5.27 KB

MoGeo: Mojo geographic and geometric vector features

Run Tests

Mojo🔥 package for geographic and geometric vector features and analytics, such as location data or earth observation data.

status 2024-01-05

🚧 pre-alpha, not yet usable!

In 2023, this package (formerly geo-features) served for learning Mojo 0.x and to experiment with the memory layout advocated by GeoArrow. GeoArrow seems quite promising, but is already well served by it's C, Rust and Python implementations. In Mojo, there is not yet support for zero-copy shared memory buffers, so I created a feature request for the python buffer protocol. Until that is supported, I not see any practical use for a GeoArrow implementation in pure Mojo.

In 2024 and beyond I'm exploring an alternative backend and memory layout using dual quaternions. Dual quaternions can represent rotations and translations, and should be useful in solving the antimeridian crossing problem. Dual quaternions have been successfully used in robotics, physics simulations, game dev, and graphics. To this end I added "Be useful for many application domains..." to the project goals.

project goals

  • Apply Mojo's systems programming features to create a native geo package with strong type safety and high performance.
  • Be useful for many application domains, not only Geographic Information Systems (GIS). Additionally: planetary information systems, oceanography, robotics, gamedev, graphics, embedded systems.
  • Promote cloud native geospatial computing and open geospatial standards.
  • Leverage the vast Python ecosystem, wherever possible, to enable rapid development and development and interoperability.

requirements

roadmap

core structs

  • Envelope
  • Feature
  • FeatureCollection
  • GeometryCollection
  • LinearRing
  • LineString
  • Memory Layout
  • MultiLineString
  • MultiPoint
  • MultiPolygon
  • Point
  • Polygon

serialization and interchange formats

  • GeoArrow
  • GeoJSON
  • GeoParquet
  • TopoJSON
  • WKT

methods and algorithms

  • area
  • perimeter
  • centroid
  • intersection
  • union
  • difference
  • parallelized+vectorized spatial join
  • rasterize from vector
  • vectorize from raster
  • re-projection and CRS support
  • simplify or decimate
  • stratified sampling?
  • zonal stats?
  • smart antimeridian crossing mode (quaternions?)

architectural decisions

  • Implement a columnar memory layout similar to GeoArrow, for efficient representation of coordinates, features and attributes. See status 2024-01-05.

related software

  • GEOS - Geometry Engine, Open Source.
  • GDAL/OGR - Geospatial Data Abstraction Library.
  • Shapely - Python package for computational geometry.
  • JTS Topology Suite - Java library for creating and manipulating vector geometry.
  • TG - Geometry library for C that is small, fast, and easy to use.
  • Turf.js - Advanced geospatial analysis for browsers and Node.js.
  • TurfPy - Python library for performing geospatial data analysis which reimplements turf.js.

specs

  • ISO/OGC Simple Features - Set of standards that specify a common storage and access model of geographic features.
  • GeoJSON - Geospatial data interchange format based on JavaScript Object Notation (JSON).
  • GeoArrow - Specification for storing geospatial data in Apache Arrow and Arrow-compatible data structures and formats.
  • GeoParquet - Specification for storing geospatial vector data (point, line, polygon) in Parquet.

setup dev environment

  1. Clone this repo, including submodules:

    git clone --recurse-submodules https://github.com/guidorice/mogeo
  2. Create a Python environment using environment.yml. This is required for supporting packages used by mogeo, for example for interchange, serialization, and unit testing. Conda is recommended because it puts a copy of libpython into each conda env.

    conda env create -n mogeo --file environment.yml
    
  3. Set MOJO_PYTHON_LIBRARY environment variable to your libpython. An example of doing this on MacOS is the scripts directory. Help: Using Mojo with Python .

  4. Run targets in Makefile, ex: make test, make package, make format.