trouble generating cell ids for MultiPollygons #322
kgeographer
started this conversation in
General
Replies: 2 comments
-
Your loops may be inverted. Check the areas. Are they closer to 0 or 4π? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank you for the quick response. For each obj, area was indeed 4π:
A Normalize() adjustment has fixed it.
the working code:
Editorial aside: ChatGPT did not recognize this problem, and proposed I consult maintainers. Fact is I could never have attempted this operation without its (incomplete) knowledge of the s2geometry library. And never have succeeded without its maintainers. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working with a clone of the s2geometry repo as of 22 July. I was able to build a wheel for Python 3.10 on an M1 Macbook, and perform several functions with it. My goal is to generate lists of cell ids at resolution of 13 for about 17000 US counties, using MultiPolygon geometries as encoded in a Django postgresql database.
The code I have tried is below. The result for any of my county MultiPolygon objects is:
['1', '3', '5', '7', '9', 'b']
, which I understand to be among the top level cells. I guess my first question is, can I expect the Python port of s2 to handle MultiPolygons, and if it can, is there anything in this code that indicates what the problem is?Yes, this code was arrived at with the assist of ChatGPT, with many iterations regarding loop-building getting to this state.
Beta Was this translation helpful? Give feedback.
All reactions