uber / uber/h3-java

polygonToCells The operation failed but a more specific error is not available

Open
#161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
333
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Hello, I do the Latest version of java, Due to the following polygon API in H3Core
public List polygonToCells(List points, List<List> holes, int res)
I use draws a circle (32-sided polygon) on the North Pole point,But the API returns no result and pops com.Uber.H3core.exceptions.H3Exception: The operation failed but a more specific error is not available。

The following video is a circle I drew through an online website https://geojson.io/. The circle that does not pass through the pole can be normally drawn through the last draw circle button on the right provided by it. However, as long as the circle passes through the pole, it will be deformed. I'm not sure if the geojson data it produces meets your requirements.

https://github.com/user-attachments/assets/ed4d6852-e014-44b5-94f5-6e5f54070777

this data set
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [ -194.1163803054172, 75.34522378592504 ], [ -202.79804595364828, 75.08129230529394 ], [ -210.74408270705123, 74.31792912520903 ], [ -217.47776602405506, 73.12779925075124 ], [ -222.84703820873705, 71.60118878562257 ], [ -226.92736680317617, 69.82411070399189 ], [ -229.8955941563057, 67.8682836712613 ], [ -231.94658416786373, 65.78980197261679 ], [ -233.25525754634793, 63.63154662185234 ], [ -233.96554012934308, 61.42635628212661 ], [ -234.19123059787654, 59.19979341150646 ], [ -234.02080094875652, 56.97224961056499 ], [ -233.5227095153603, 54.76045900336646 ], [ -232.75003955841126, 52.578560376784246 ], [ -231.7442074873595, 50.43883619244312 ], [ -230.53781701503405, 48.35222547711341 ], [ -229.15682267959772, 46.328678984566665 ], [ -227.62216408504375, 44.37740342939607 ], [ -225.95100400034877, 42.507026492363146 ], [ -224.15767243321204, 40.72570409321321 ], [ -222.25439228214108, 39.04118465227111 ], [ -220.25184151298043, 37.460840618304076 ], [ -218.1595913773881, 35.99167466570193 ], [ -215.98644891825109, 34.640306145288605 ], [ -213.74072388882635, 33.41294226356962 ], [ -211.43043445198086, 32.31533782640306 ], [ -209.06346202950883, 31.35274704441481 ], [ -206.64766300543187, 30.529870731187223 ], [ -204.1909433305941, 29.85080213162248 ], [ -201.70130118095764, 29.318974517934137 ], [ -199.18684248495413, 28.937113523758264 ], [ -196.65577417807796, 28.70719691091932 ], [ -194.1163803054172, 28.63042405664924 ], [ -191.57698643275643, 28.70719691091932 ], [ -189.04591812588023, 28.937113523758264 ], [ -186.53145942987675, 29.318974517934137 ], [ -184.04181728024028, 29.850802131622476 ], [ -181.5850976054025, 30.529870731187223 ], [ -179.16929858132556, 31.35274704441481 ], [ -176.80232615885353, 32.31533782640306 ], [ -174.49203672200804, 33.41294226356962 ], [ -172.24631169258328, 34.640306145288605 ], [ -170.0731692334463, 35.991674665701915 ], [ -167.98091909785393, 37.46084061830407 ], [ -165.9783683286933, 39.04118465227112 ], [ -164.0750881776223, 40.72570409321321 ], [ -162.28175661048562, 42.50702649236313 ], [ -160.61059652579064, 44.37740342939607 ], [ -159.07593793123667, 46.328678984566665 ], [ -157.6949435958003, 48.3522254771134 ], [ -156.48855312347487, 50.43883619244312 ], [ -155.48272105242316, 52.578560376784246 ], [ -154.71005109547406, 54.76045900336646 ], [ -154.21195966207787, 56.97224961056499 ], [ -154.04153001295788, 59.199793411506455 ], [ -154.2672204814913, 61.42635628212661 ], [ -154.97750306448646, 63.63154662185234 ], [ -156.28617644297069, 65.78980197261676 ], [ -158.3371664545287, 67.8682836712613 ], [ -161.3053938076582, 69.82411070399189 ], [ -165.38572240209734, 71.60118878562257 ], [ -170.75499458677925, 73.12779925075121 ], [ -177.48867790378313, 74.317929125209 ], [ -185.4347146571861, 75.08129230529394 ], [ -194.1163803054172, 75.34522378592504 ] ] ] } }, { "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [ -157.9553759595192, 76.20551405214356 ], [ -148.15087725707932, 76.11503903755579 ], [ -138.5249341098825, 75.84786849764 ], [ -129.22877377739908, 75.41598771197921 ], [ -120.36858172755038, 74.83709827934858 ], [ -112.00126270158901, 74.1321100159357 ], [ -104.14101567343404, 73.32286098356263 ], [ -96.77107917886019, 72.43046726111959 ], [ -89.85575422611579, 71.47436403119023 ], [ -83.35008417778214, 70.47190035041943 ], [ -77.20652404120405, 69.4382956487094 ], [ -71.37898243436854, 68.38679315167023 ], [ -65.82495077344247, 67.32889697179213 ], [ -60.50639322476403, 66.27462608403098 ], [ -55.38990573515342, 65.23275109351692 ], [ -50.44648428456734, 64.21099962455772 ], [ -45.65111213362515, 63.216227023658355 ], [ -40.98228691386797, 62.25455433891631 ], [ -36.42155227855348, 61.33147766687846 ], [ -31.95306533448146, 60.451953466861696 ], [ -27.56321204690391, 59.62046419847658 ], [ -23.24027257508398, 58.84106810190698 ], [ -18.97413340157972, 58.11743634094389 ], [ -14.756040920429827, 57.452880168157826 ], [ -10.57839051631735, 56.85037028723903 ], [ -6.4345453293581025, 56.312550185366256 ], [ -2.318679425995525, 55.841744880699544 ], [ 1.7743592501023142, 55.43996626416569 ], [ 5.849170115454888, 55.10891599751388 ], [ 9.90990873900712, 54.84998674936952 ], [ 13.960386036305291, 54.66426239784938 ], [ 18.004160284502717, 54.55251769437587 ], [ 22.044624040480805, 54.515217762607676 ], [ 26.085087796458893, 54.55251769437587 ], [ 30.128862044656316, 54.66426239784938 ], [ 34.179339341954496, 54.84998674936952 ], [ 38.24007796550671, 55.10891599751388 ], [ 42.31488883085929, 55.43996626416569 ], [ 46.40792750695716, 55.841744880699544 ], [ 50.52379341031971, 56.312550185366256 ], [ 54.667638597278966, 56.85037028723903 ], [ 58.84528900139146, 57.452880168157826 ], [ 63.063381482541295, 58.11743634094387 ], [ 67.32952065604559, 58.84106810190698 ], [ 71.65246012786552, 59.62046419847658 ], [ 76.04231341544308, 60.451953466861696 ], [ 80.51080035951503, 61.33147766687844 ], [ 85.07153499482959, 62.25455433891631 ], [ 89.74036021458677, 63.216227023658355 ], [ 94.53573236552889, 64.2109996245577 ], [ 99.47915381611504, 65.23275109351692 ], [ 104.59564130572565, 66.27462608403098 ], [ 109.91419885440406, 67.32889697179213 ], [ 115.46823051533015, 68.38679315167023 ], [ 121.29577212216567, 69.4382956487094 ], [ 127.43933225874373, 70.47190035041943 ], [ 133.9450023070774, 71.47436403119023 ], [ 140.86032725982182, 72.43046726111959 ], [ 148.23026375439568, 73.32286098356263 ], [ 156.0905107825506, 74.1321100159357 ], [ 164.457829808512, 74.83709827934858 ], [ 173.31802185836065, 75.41598771197921 ], [ 182.6141821908441, 75.84786849764 ], [ 192.24012533804097, 76.11503903755579 ], [ -157.9553759595192, 76.20551405214356 ] ] ] } } ] }

At the same time, I did not find a method to draw polygons in H3 API, so I implemented a method to draw a 64-deformed approximate circle with a radius of 500km and the center point being the North Pole. The visualization result is here https://geojson.io/. The site is not displayed, due to its possible deformation, not sure if it can be. However, it is possible to change the visual website to a non-GeoJSON format, the result is shown below,

test

and the data set,You can replace the relevant data of the coordinates node in geojson

`
[180.0,85.49876320635526],
[-174.37500000000003,85.49876320635526],
[-168.75000000000003,85.49876320635526],
[-163.125,85.49876320635526],
[-157.5,85.49876320635526],
[-151.875,85.49876320635526],
[-146.25000000000003,85.49876320635526],
[-140.625,85.49876320635526],
[-135.00000000000003,85.49876320635526],
[-129.37500000000003,85.49876320635526],
[-123.75,85.49876320635526],
[-118.12500000000001,85.49876320635526],
[-112.50000000000003,85.49876320635526],
[-106.875,85.49876320635526],
[-101.25000000000003,85.49876320635526],
[-95.62500000000003,85.49876320635526],
[-90.00000000000001,85.49876320635526],
[-84.37500000000001,85.49876320635526],
[-78.75000000000001,85.49876320635526],
[-73.12500000000003,85.49876320635526],
[-67.50000000000001,85.49876320635526],
[-61.875,85.49876320635526],
[-56.25000000000003,85.49876320635526],
[-50.62500000000002,85.49876320635526],
[-45.00000000000001,85.49876320635526],
[-39.37500000000001,85.49876320635526],
[-33.75000000000001,85.49876320635526],
[-28.12500000000002,85.49876320635526],
[-22.500000000000014,85.49876320635526],
[-16.87500000000001,85.49876320635526],
[-11.250000000000027,85.49876320635526],
[-5.6250000000000195,85.49876320635526],
[-1.4033418597069754E-14,85.49876320635526],
[5.624999999999992,85.49876320635526],
[11.249999999999998,85.49876320635526],
[16.874999999999975,85.49876320635526],
[22.499999999999986,85.49876320635526],
[28.124999999999996,85.49876320635526],
[33.74999999999998,85.49876320635526],
[39.37499999999997,85.49876320635526],
[44.999999999999986,85.49876320635526],
[50.62499999999997,85.49876320635526],
[56.25,85.49876320635526],
[61.874999999999986,85.49876320635526],
[67.49999999999996,85.49876320635526],
[73.12499999999999,85.49876320635526],
[78.74999999999997,85.49876320635526],
[84.37500000000001,85.49876320635526],
[89.99999999999999,85.49876320635526],
[95.62499999999996,85.49876320635526],
[101.24999999999999,85.49876320635526],
[106.87499999999999,85.49876320635526],
[112.50000000000001,85.49876320635526],
[118.12500000000001,85.49876320635526],
[123.74999999999999,85.49876320635526],
[129.37500000000003,85.49876320635526],
[135.0,85.49876320635526],
[140.625,85.49876320635526],
[146.25000000000003,85.49876320635526],
[151.87499999999997,85.49876320635526],
[157.49999999999994,85.49876320635526],
[163.12499999999997,85.49876320635526],
[168.74999999999997,85.49876320635526],
[174.375,85.49876320635526],
[179.99999999999997,85.49876320635526],

`

if you find it troublesome to implement a round data set with errors, you can also have an equilateral triangle with the North Pole as the center point, and the data set points I tested will also find errors(Any figure passing through a pole)

`
[0, 80],
[120, 80],
[-120, 80],
[0, 80]

`
test1

At the same time, I found the same problem in a comparison experiment in a journal paper published around 2022.Thank you for taking the time to look at the problems I have described, which have caused you trouble

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the H3Core.polygonToCells API and reproduce the supplied coordinates with the latest Java version, comparing the pole-crossing polygon with the non-pole example. Determine the expected behavior for this input and resolve the report with a clear result for the supplied case, including whether the failure should expose a more specific error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.