s2geometry | Computational geometry and spatial indexing on the sphere | 3D Animation library
kandi X-RAY | s2geometry Summary
kandi X-RAY | s2geometry Summary
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. If you want to learn more about the library, start by reading the overview and quick start document, then read the introduction to the basic types. S2 documentation can be found on s2geometry.io.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of s2geometry
s2geometry Key Features
s2geometry Examples and Code Snippets
Community Discussions
Trending Discussions on s2geometry
QUESTION
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 according to the zone I locate them in.
I used Python 3.7 and FastAPI to create the microservice and the routes to communicate with it.
The microservice runs smoothly on my local machine and on Compute Engines as most of my routes takes less than 150 ms to answer when I test them. However I have a latency issue when I deploy it with Cloud Run. From time to time the microservice takes a really long time to answer (up to 15 mins) and I can't pin point what exactly causes it.
Here is a screen shot where we can see the Request Count and the Request Latency :
Request Count and Request Latency
There are no real correlations between the requests latency and the number of requests or at least no trivial ones. I also looked at the memory usage of the service and the memory usage is at 30% at most. The CPU usage however some times hit 100% but not necessarily when requests are slow.
Finally when I explored the Trace List and compared requests that have high latency I noticed the following difference
Trace of slow request
Trace of fast request
Fast requests seem to call themselves whereas slow requests don't and I do not know why.
For now we do not really have a lot of users so I thought that it could be a cold start issue but slow requests are not necessarily the first ones.
Now, to be honest I don't know what's going on here and what Cloud Run does (or what I did wrong) and I also find it pretty difficult to find a thorough explanation on how Cloud Run actually works so if you have one (other than the google one) I would gladly dive into it.
Thank your very much for you help
...ANSWER
Answered 2020-Sep-25 at 07:27After different experiments it seems that it was a cold start issue. Cloud Run container are stoped after a certain time if they are not begin used and as we did not have a lot of traffic the container had to boot every time a user wanted to access the app.
Solution :
I created a Cloud Function that sends a request to the container when triggered and then created a Cloud Scheduler job that runs the function every minute.
Note :
If different revisions are routed to your service you need to create a Cloud Scheduler job for each of the revision. To do so you have to create a Revision URL (tag) for each of the routed revision (currently beta).
QUESTION
Hey everyone, I recently discovered Google's open source S2 library
https://github.com/google/s2geometry
I am currently programming an application that requires finding K closest points, given an original target point. Currently I am using PostgreSQL with geospatial indexes on columns containing latitude/longitude values to achieve this - However, I am looking for alternatives when S2 caught my eye.
QuestionsI am rather unfamiliar with the library, and I have some questions regarding it.
1) Is it possible to find K closest points using the S2 library
2) How fast would the query in S2 be vs Geospatial indexes (superior/inferior/same/etc)
...ANSWER
Answered 2019-Sep-10 at 16:29Google's S2 library is a form of geohashing. It can be used to optimize your geo lookups significantly since it's just a hash/id lookup.
One method of indexing could be:
Index all your points that you care about on a fairly large S2 cell level. You should evaluate your points and see what level works for you based on this chart.
On retrieval, convert your search point to an S2 cell at that level, and then pull all candidate points based on that.
(Optional depending on the accuracy you care about) Calculate distance between candidate points and search point and sort
There are some trade-offs with this performance gain:
Indexing S2-cells on your points means slightly more storage (64-bit integers per id)
You may miss points outside of the S2 cell that you queried by. You could index on multiple levels of S2 to ensure you retrieve enough points. Depending on the density of your points, this might not be an issue.
Retrieving by S2 cell IDs won't actually give you the distance between points - you'll have to calculate that yourself
Here's a code example from the Node S2 library:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install s2geometry
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page