{"id":16434501,"url":"https://github.com/halfrost/s2","last_synced_at":"2025-04-23T09:08:50.448Z","repository":{"id":49822990,"uuid":"107946646","full_name":"halfrost/S2","owner":"halfrost","description":"S2 geometry library in Go | experiment version","archived":false,"fork":false,"pushed_at":"2021-12-16T17:32:54.000Z","size":1221,"stargazers_count":21,"open_issues_count":779,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T09:08:39.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halfrost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-23T07:28:03.000Z","updated_at":"2023-11-09T17:31:58.000Z","dependencies_parsed_at":"2022-08-12T20:40:53.802Z","dependency_job_id":null,"html_url":"https://github.com/halfrost/S2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfrost%2FS2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfrost%2FS2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfrost%2FS2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfrost%2FS2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halfrost","download_url":"https://codeload.github.com/halfrost/S2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250403831,"owners_count":21424794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T08:49:19.377Z","updated_at":"2025-04-23T09:08:50.417Z","avatar_url":"https://github.com/halfrost.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Update\n\n\nS2/regioncoverer.go  \nS2/cellid.go  \nS2/cellunion.go  \n\n# Overview\n\nThis is a library for manipulating geometric shapes. Unlike many geometry\nlibraries, S2 is primarily designed to work with _spherical geometry_, i.e.,\nshapes drawn on a sphere rather than on a planar 2D map. (In fact, the name S2\nis derived from the mathematical notation for the unit sphere.) This makes it\nespecially suitable for working with geographic data.\n\nThe library consists of:\n\n*   Basic representations of angles, intervals, latitude-longitude points, unit\n    3D vectors, and conversions among them.\n\n*   Various shapes over the unit sphere, such as spherical caps (\"discs\"),\n    latitude-longitude rectangles, polylines, and polygons. These are\n    collectively known as \"regions\".\n\n*   Support for spatial indexing of collections of geometry, and algorithms for\n    testing containment, finding nearby objects, finding intersections, etc.\n\n*   A hierarchical decomposition of the sphere into regions called \"cells\". The\n    hierarchy starts with the six faces of a projected cube and recursively\n    subdivides them in a quadtree-like fashion.\n\n*   The ability to approximate arbitrary regions as a collection of cells. This\n    is useful for building inverted indexes that allow queries over arbitrarily\n    shaped regions.\n\nThe implementations attempt to be precise both in terms of mathematical\ndefinitions (e.g. whether regions include their boundaries, representations of\nempty and full regions) and numerical accuracy (e.g. avoiding cancellation\nerror).\n\nNote that the intent of this library is to represent geometry as a mathematical\nabstraction. For example, although the unit sphere is obviously a useful\napproximation for the Earth's surface, functions that are specifically related\nto geography are not part of the core library (e.g. easting/northing\nconversions, ellipsoid approximations, geodetic vs. geocentric coordinates,\netc).\n\nSee http://godoc.org/github.com/golang/geo for specific package documentation.\n\nFor an analogous library in C++, see\nhttps://code.google.com/archive/p/s2-geometry-library/, and in Java, see\nhttps://github.com/google/s2-geometry-library-java\n\n# Status of the Go Library\n\nThis library is principally a port of [the C++ S2\nlibrary](https://code.google.com/archive/p/s2-geometry-library), adapting to Go\nidioms where it makes sense. We detail the progress of this port below relative\nto that C++ library.\n\n*Note*: The C++ code on `code.google.com` is an out-of-date snapshot of the\nGoogle-internal version, and isn't the basis of this Go library. When the C++\nlibrary is re-released, we will update this document.\n\n## [ℝ¹](https://godoc.org/github.com/golang/geo/r1) - One-dimensional Cartesian coordinates\n\nFull parity with C++.\n\n## [ℝ²](https://godoc.org/github.com/golang/geo/r2) - Two-dimensional Cartesian coordinates\n\nFull parity with C++.\n\n## [ℝ³](https://godoc.org/github.com/golang/geo/r3) - Three-dimensional Cartesian coordinates\n\nFull parity with C++.\n\n## [S¹](https://godoc.org/github.com/golang/geo/s1) - Circular Geometry\n\n**Complete**\n\n*   ChordAngle\n\n**Mostly complete**\n\n*   Angle - Missing Arithmetic methods, Trigonometric methods, Conversion\n    to/from s2.Point, s2.LatLng, convenience methods from E5/E6/E7\n*   Interval - Missing ClampPoint, Complement, ComplementCenter,\n    HaussdorfDistance\n\n## [S²](https://godoc.org/github.com/golang/geo/s2) - Spherical Geometry\n\nApproximately ~40% complete.\n\n**Complete** These files have full parity with the C++ implementation.\n\n*   Cap\n*   Cell\n*   CellID\n*   LatLng\n*   matrix3x3\n*   Metric\n*   PaddedCell\n*   Point\n*   Region\n*   s2edge_clipping\n*   s2edge_crosser\n*   s2edge_crossings\n*   s2rect_bounder\n*   s2stuv.go (s2coords.h in C++) - This file is a collection of helper and\n    conversion methods to and from ST-space, UV-space, and XYZ-space.\n*   s2wedge_relations\n*   ShapeIndex\n\n**Mostly Complete** Files that have almost all of the features of the original\nC++ code, and are reasonably complete enough to use in live code. Up to date\nlisting of the incomplete methods are documented at the end of each file.\n\n*   CellUnion - Missing Union, Intersection, etc.\n*   Loop - Loop is mostly complete now. Missing Projection, Distance, Contains,\n    Intersects, Union, etc.\n*   Polyline - Missing Projection, Intersects, Interpolate, etc.\n*   Rect (AKA s2latlngrect in C++) - Missing Centroid, Distance,\n    InteriorContains.\n*   RegionCoverer - Missing FloodFill and SimpleCovering.\n*   s2_test.go (AKA s2testing and s2textformat in C++) - Missing Fractal test\n    shape generation. This file is a collection of testing helper methods.\n*   s2edge_distances - Missing Intersection, ClosestPair.\n\n**In Progress** Files that have some work done, but are probably not complete\nenough for general use in production code.\n\n*   Polygon - Polygons with multiple loops are supported. It fully\n    implements Shape and Region, but it's missing most other methods. (Area,\n    Centroid, Distance, Projection, Intersection, Union, Contains, Normalized,\n    etc.)\n*   PolylineSimplifier - Initial work has begun on this.\n*   s2predicates.go - This file is a collection of helper methods used by other\n    parts of the library.\n\n**Not Started Yet.** These files (and their associated unit tests) have\ndependencies on most of the In Progress files before they can begin to be\nstarted.\n\n*   BoundaryOperation\n*   Builder - This is a robust tool for creating the various Shape types from\n    collection of simpler S2 types.\n*   BuilderGraph\n*   BuilderLayers\n*   BuilderSnapFunctions\n*   ClosestEdgeQuery\n*   ClosestPointQuery\n*   ConvexHullQuery\n*   ContainsPointQuery - ShapeContainsPoint and FindContainingShapes\n*   CrossingEdgeQuery\n*   EdgeTesselator\n*   PointCompression\n*   PointIndex\n*   PolygonBuilder\n*   RegionIntersection\n*   RegionUnion\n*   Projections\n*   shapeutil\n*   lexicon\n*   priorityqueuesequence\n\n### Encode/Decode\n\nEncoding of S2 Go types is committed and is interoperable with C++ and Java.\nDecoding for Loops, Polygons, Polylines, and Rects is now completed. The\nremaining types will be worked on in the future.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfrost%2Fs2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalfrost%2Fs2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfrost%2Fs2/lists"}