A general-purpose geospatial Java library providing shapes, distance calculations, and format support for Euclidean and geodesic models.
Spatial4j is a general-purpose spatial and geospatial library for Java that provides shapes, distance calculations, and format support for both Euclidean and geodesic (spherical) world models. It solves problems like handling geographic data, performing accurate spatial math, and integrating with spatial indexing schemes such as Geohash.
Java developers working with geographic data, spatial indexing, or search applications (e.g., in Apache Lucene/Solr) who need geodesic-aware shapes and calculations.
Developers choose Spatial4j for its geodesic circle implementation, support for multiple spatial models, and seamless integration with formats like WKT and GeoJSON, filling gaps left by libraries like JTS.
LocationTech Spatial4j: A Geospatial Library for Java
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements a unique point-radius shape on a sphere with extensive testing, addressing a gap in libraries like JTS that lack this feature, as highlighted in the 'Why not use JTS?' section.
Provides shapes like Point and Rectangle that operate in Euclidean, cylindrical, and spherical models, making it versatile for various spatial applications, as shown in the shape compatibility table.
Supports reading and writing shapes from WKT, GeoJSON, and Polyshape formats, with Jackson serialization integration, easing data interchange, as detailed in the 'Other Features' section.
Designed with spatial indexing in mind, such as for Geohash, with efficient algorithms to minimize great-circle distance calculations, making it ideal for information-retrieval domains like Apache Lucene.
Key shapes like Polygon and LineString do not support the spherical model, limiting use for full geodesic geometry, as admitted in the shape table where they are marked 'N' for spherical.
Features like polygon support and GeoJSON parsing require optional dependencies on JTS and Noggit, which can complicate setup and increase project footprint, as noted in the Dependencies section.
Lacks support for map projections and pole-wrap for polygons, with these only listed as future ideas in the roadmap, which may be critical for comprehensive GIS applications.