Questions tagged [s2]

Computational geometry and spatial indexing on the sphere This is a package for manipulating geometric shapes. Unlike many geometry libraries, S2 is primarily designed to work with spherical geometry, i.e., shapes drawn on a sphere rather than on a planar 2D map. This makes it especially suitable for working with geographic data.

The tag is for discussing Google S2 spherical geometry library, https://s2geometry.io/, and S2 hierarchical cell indexing in general. Also for discussing its ports to other languages and applications.

https://github.com/google/s2geometry

24 questions
40
votes
2 answers

How to resolve spherical geometry failures when joining spatial data

I have a shapefile (with several polygons) and a dataframe with coordinates. I want to assign each coordinate in a dataframe to a polygon in a shapefile. So to add a column in a data frame with a polygon name or id Here is the link to the data…
yuliaUU
  • 1,581
  • 2
  • 12
  • 33
8
votes
1 answer

How to perform the Search operation using Google S2 geometry

I have geo location of vehicles and my point in the city and I need to find those vehicles that are within 5kms radius of my point. I could represent the vehicle locations and my point with S2 cell id. But how can i query ? can I store data for all…
Loyalist1
  • 120
  • 1
  • 7
7
votes
3 answers

Using Python S2/S2sphere library - find all s2 cells of a particular level with in a circle(lat, long and radius is given)

What S2Region and how should I use to get all s2 cells at certain parent level(let say 9) covered by the circle drawn from given lat, long and radius. Below is an example which use python s2 library for getting all cells under a…
Gaurav Jain
  • 401
  • 6
  • 18
5
votes
1 answer

How to find the locations (indices whose lat long co-ordinates are stored in geo-json format) within 5 Km radius of a h3 index in h3-js?

I'm creating a hyper local delivery service app . I can only receive order if there is a store within 5 km radius from the user . I stored the store locations in geojson format . Is there a function in h3-js which will take radius , array of stores…
4
votes
3 answers

S2 Geo Functions in BigQuery?

I'm just wondering if there is any plans to add functions for the S2 geo library into BigQuery? Seems like surely lots of people have lat-long data in BQ - some s2 functions to got to cells and back etc would be super useful surely - happy to file a…
andrewm4894
  • 1,451
  • 4
  • 17
  • 37
3
votes
1 answer

How to fix spherical geometry errors caused by conversion from GEOS to s2

I'm having the same problem as How to resolve spherical geometry failures when joining spatial data My code that used to work now doesn't work with the conversion from GEOS to s2. I'm not sure how I would create a reproducible example of this error.…
canderson156
  • 1,045
  • 10
  • 24
3
votes
1 answer

Possible to find K closest points using S2 library (and is it effective)?

Background I recently discovered Google's open source S2 library for manipulating geometric shapes. https://github.com/google/s2geometry I'm developing an app that needs to locate the K nearest points to a target point. Currently, I'm utilizing…
AlanSTACK
  • 5,525
  • 3
  • 40
  • 99
3
votes
1 answer

How to convert between Hilbert Curve QuadTree and S2 Geometry CellId

Problem Let's say I know the Hilbert Curve Face and Quadtree, such as 4/032212303102122 (face 4, level 15). Or perhaps I know the S2 Geometry CellId, such as 9749618424903892992. How can I convert from the one to the other? Application (this is the…
coolaj86
  • 74,004
  • 20
  • 105
  • 125
1
vote
1 answer

S2Polygon contains return true for a Point that not inside the Polygon

I have a S2Polygon and need to check whether a point is inside the Polygon or outside. I expect this testcase to pass: @Test void testPolygonContainsPoint() { // create a list of (latitude, longitude) points …
CPJoshi
  • 387
  • 4
  • 11
1
vote
0 answers

Performing a location proximity search on a database using S2 Geometry Library

I am working on a project that requires fast performing proximity queries on a database with location data. In my database I want to store locations with additional information. Idea is that user opens a map on a certain location and my program only…
1
vote
1 answer

Cloud Run - Requests latency

I am trying to use Cloud Run to run a microservice connected to Firestore. The microservice creates objects based on s2geometry to create multiple geographical zones with specific attributes and thus help localizing users to send them information…
1
vote
1 answer

How to use geo/s2 library to determine a LatLong lies inside a radius from another LatLong in Go?

I have tried this code , couldn't find any examples for geo/s2 for Go package main import ( "fmt" "github.com/golang/geo/s2" ) func main(){ rect := s2.RectFromLatLng(s2.LatLngFromDegrees(12.9279,77.6271)) rect =…
1
vote
1 answer

S2RegionCoverer not respecting min/max cell level?

When using Google's S2 geometry library to draw S2 cells on a google map widget, I'm getting cells that are outside my specified (constant) range. S2RegionCoverer cov = new S2RegionCoverer(); cov.setMaxLevel(14); cov.setMinLevel(14); S2CellUnion…
Sander
  • 412
  • 2
  • 14
0
votes
0 answers

Complex lambda with sqlalchemy filter query

Consider an ORM class describing a "Store": class Store(Base, AbstractSchema): __tablename__ = 'store' id = Column(Integer, primary_key=True) ... s2_cell_id = Column(BigInteger, unique=False, nullable=True) s2_cell_id…
John C.
  • 405
  • 5
  • 19
0
votes
0 answers

Adding a Before/After Slider to a Leaflet Map in R

I am presently reading though Uber's H3 documentation and am wondering if its possible to add a before/after slider to a leaflet map created in R. For visual reference,I am looking to figure out how to add this. Is there anything readily available…
Bensstats
  • 988
  • 5
  • 17
1
2