Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing chip / cell when indexing geometry #458

Open
magabarron opened this issue Nov 20, 2023 · 0 comments
Open

Missing chip / cell when indexing geometry #458

magabarron opened this issue Nov 20, 2023 · 0 comments

Comments

@magabarron
Copy link

magabarron commented Nov 20, 2023

Describe the bug
We are indexing a geometry using grid_tessellateexplode with resolution=10.

We have realised that Mosaic is missing one of the chips that should be covering the geometry. The chip corresponds to the h3 cell 622189145948291100.

When investigating the issue, we have indexed the same geometry using grid_geometrykringexplode with resolution=10 and k=0, and the same cell is missed.

We are using:

  • JTS API
  • Mosaic version 0.3.12
  • Runtime 12.2 LTS ML

Our cluster has only Mosaic installed.

To Reproduce
Steps to reproduce the behavior:

  1. Create the dataframe
df = spark.createDataFrame([{'wkt': 'MULTIPOLYGON (((-89.13543460006571 42.08515500047617, -89.13550100009168 42.08515400061563, -89.13557980035587 42.08515480050856, -89.13567619990977 42.085154600783305, -89.13587559977988 42.08515380060551, -89.13597660013033 42.0851526004956, -89.13607800020118 42.08515300049073, -89.1361785997097 42.08515260060617, -89.13627799990164 42.08515300051709, -89.13637740034203 42.085151800679554, -89.1364773999447 42.08515340041258, -89.1365780000446 42.085155200670414, -89.13659600016162 42.085155026057876, -89.13659600000327 42.08523199998497, -89.13645200032506 42.0853420000342, -89.13607799986104 42.085430000201015, -89.13568100009032 42.08548700023055, -89.1354830000611 42.0855559999915, -89.1352309998663 42.0856779997445, -89.13516334170049 42.08571834872525, -89.13516732503466 42.08524787904356, -89.1352307576664 42.08518790730232, -89.13530646308419 42.08515469626152, -89.13543460006571 42.08515500047617)), ((-89.1386029999859 42.085379999739764, -89.1387100001531 42.085471999874095, -89.13880100035601 42.085590000179444, -89.13896899972084 42.085986999991725, -89.13906100008187 42.08666599986219, -89.13904499962938 42.08671199977065, -89.13906099980399 42.08684199989335, -89.13902999995403 42.08689499979704, -89.1390070001738 42.08704400018317, -89.13883199977518 42.08735999986532, -89.13870199984552 42.08747899994903, -89.13859499965193 42.08761999997976, -89.13840499992642 42.087727000270824, -89.1383050001173 42.08775700018625, -89.13819899998649 42.08775699990201, -89.13812200000818 42.08773800020177, -89.1380229998071 42.08766200005757, -89.13799999968846 42.08755500016996, -89.13803799993711 42.087326000093874, -89.13800800002058 42.08728799987269, -89.13796999985746 42.08728000009618, -89.13777099974554 42.08734900000255, -89.13761099976591 42.08744799996409, -89.13727500010731 42.087508999930165, -89.13693999993619 42.08760099983864, -89.1367870001046 42.08769999992441, -89.13671100011227 42.08780700022968, -89.136757000063 42.0878870001118, -89.13690899973028 42.08793600002557, -89.137214000329 42.08787500010907, -89.13732099990015 42.08787500015006, -89.13742800001866 42.087893999763516, -89.13755799992087 42.08795899997947, -89.13774900003791 42.08808899975197, -89.13799299971156 42.08811900010906, -89.13812999998405 42.088100000037514, -89.13843499995536 42.088000999731136, -89.13862599974078 42.08795500024913, -89.13894600015472 42.08797799995559, -89.13907600029019 42.088028000122215, -89.13917499997227 42.088111999852856, -89.13922900015953 42.08823000024724, -89.13931199981393 42.08835199982366, -89.13941899983988 42.08841700017066, -89.13950299972272 42.08844799976572, -89.13962500014023 42.08857700002083, -89.13962499993511 42.08865000003495, -89.13958700011393 42.08873000023003, -89.13956170772008 42.08876332946428, -89.13949279984672 42.08876160039599, -89.13937360011127 42.08876180063924, -89.13924139975012 42.08876480029694, -89.139103399669 42.088765400729706, -89.13896220009518 42.08876480065122, -89.13882100036771 42.08876720072415, -89.13867959963765 42.08876700050812, -89.13853520028499 42.08876620057683, -89.13839000031427 42.08876600080478, -89.13824559991681 42.088766200439714, -89.13810039974412 42.08876760051195, -89.13795580008198 42.088767800340506, -89.13781059979081 42.08876860031164, -89.13766519981682 42.08876700061931, -89.13751699974284 42.08876760030165, -89.1373694000939 42.08876780066558, -89.13726735988907 42.08876780061655, -89.13729099984086 42.088752999738446, -89.1374739998714 42.08858899994179, -89.13746599982976 42.088467000218536, -89.13732900035913 42.08837500012718, -89.13722199965102 42.088344000228204, -89.13713799978682 42.08834399993351, -89.13696300022703 42.0883640002318, -89.13689399975101 42.08838999975611, -89.13680200000812 42.088383000163034, -89.13666499990708 42.088282999879674, -89.13652000008551 42.08810000000294, -89.13638300035447 42.08801300004933, -89.13622300013394 42.08797099984398, -89.13611599982481 42.087990000108, -89.13600100016333 42.0880740001556, -89.13592499999675 42.08823000011054, -89.13595499974814 42.08855399975676, -89.13603199964409 42.08869499999734, -89.13608676728542 42.088769129548, -89.13606639980634 42.08876920066491, -89.13597179976456 42.08876820062692, -89.13589379988152 42.08876700078209, -89.13582380005771 42.08876640082026, -89.13575479979119 42.088762800450695, -89.13568740022568 42.08876060063242, -89.13561819984538 42.08875780056953, -89.13555040029065 42.08875560068741, -89.13547679994011 42.08875280072027, -89.13540419965544 42.08875400036536, -89.13533359991493 42.08875740037742, -89.13527699975761 42.088761800280324, -89.13522369844839 42.08875924453753, -89.13517286893938 42.08874561434647, -89.13513792767006 42.088719971858346, -89.13513962509623 42.0885194876779, -89.13515499988111 42.088523999817724, -89.13519300005918 42.088531000049485, -89.1352839996693 42.08850099989984, -89.13538299964918 42.08841299986089, -89.13545200000645 42.08819600017545, -89.13543699967961 42.08795199982866, -89.1353760001722 42.087738000151525, -89.13523099988599 42.08761600010537, -89.13514727477694 42.08761600012947, -89.13514954711573 42.08734760522077, -89.1351700003484 42.087348999873036, -89.13542900009132 42.08731799979144, -89.13564300035154 42.08726499991789, -89.13577199968834 42.08726100022978, -89.13600900010404 42.08731400009348, -89.13620700000108 42.087313999774445, -89.13631400029092 42.08729599989982, -89.13636799995383 42.08723799999698, -89.13632900015101 42.087161999862886, -89.1362300003486 42.087108999736046, -89.13582600000389 42.087035999874395, -89.13574999999746 42.086978999726654, -89.13571900004976 42.08691800011553, -89.1357420002883 42.08684500019014, -89.1358030002703 42.08677300019348, -89.13585600016681 42.08673799994918, -89.13600100000646 42.0866889999135, -89.13629099969542 42.086674000236805, -89.13642899975925 42.08658199990661, -89.1364439996447 42.08651700018181, -89.13641300025472 42.08646400015326, -89.1361460002553 42.08628100011728, -89.13609999971118 42.086188999765064, -89.1361000000057 42.08613200016938, -89.13619200034911 42.086005999808506, -89.1362610002785 42.085964000246065, -89.13630700004478 42.085955999756656, -89.1364210001249 42.08597900023704, -89.13653500004713 42.08607099985391, -89.13660399968148 42.08619299994153, -89.1366730002704 42.08627299981711, -89.13675700017387 42.086327000271396, -89.13687099986399 42.086338000101044, -89.13698499974362 42.08628099994681, -89.13705400022 42.08620500024636, -89.13712300010513 42.08598299985938, -89.13728299970047 42.08570500016811, -89.13745899973149 42.085506000024594, -89.13767999981185 42.08535800027374, -89.13783999971726 42.08530799983461, -89.13805400034893 42.085266000132734, -89.13839700031177 42.08531600013738, -89.1386029999859 42.085379999739764)), ((-89.13985659995049 42.08763320073363, -89.13985719980758 42.08770420031198, -89.13985780031878 42.08777240075541, -89.13985960026875 42.08784040046204, -89.1398603997867 42.08790740032401, -89.13985900024268 42.08797280069311, -89.13986200012212 42.0880358006784, -89.13985959988138 42.08809900063415, -89.13986060000028 42.08816180067929, -89.13985959989084 42.08822340031294, -89.13986019996928 42.08828480027368, -89.1398598734153 42.08829078625213, -89.1398310002661 42.08828699976417, -89.13970900000933 42.088214999840254, -89.13961000019901 42.08813100002397, -89.13954100019501 42.08804700004549, -89.13950300001808 42.08788299983681, -89.1395260001956 42.08772699989652, -89.13957900026476 42.087669000212856, -89.13969400024027 42.08760099977713, -89.13983099988806 42.087555000251825, -89.13985649110333 42.08754952097211, -89.13985620010007 42.087556400583836, -89.13985659995049 42.08763320073363)))'}])
  1. Plot geometry:
%%mosaic_kepler
df "wkt" "geometry"

image

  1. Index:
tess_10 = (df.withColumn("index", grid_tessellateexplode(f.col('wkt'), f.lit(10)))
   .withColumn('CellID', f.col('index.index_id'))
   .withColumn('IsCore', f.col('index.is_core'))
   .withColumn('WKB', f.col('index.wkb'))
   .withColumn('IsValid', st_isvalid('WKB'))
   .drop("index", "wkt"))
  1. Plot chips:
%%mosaic_kepler
tess_10_df "WKB" "geometry"

Part of the polygon on the top left corner is missed.

image

Expected behavior
We would expect that a chip that corresponds to the intersection between cell 622189145948291100 and our geometry is produced.

Additional context

  • When using ESRI API, the missing chip is produced.
  • When indexing an envelope of the geometry, the chip for cell 622189145948291100 is produced.
df_env = df.withColumn('env', st_envelope(f.col('wkt')))

tess_10_env = (df_env.withColumn("index", grid_tessellateexplode(f.col('env'), f.lit(10)))
   .withColumn('CellID', f.col('index.index_id'))
   .withColumn('IsCore', f.col('index.is_core'))
   .withColumn('WKB', f.col('index.wkb'))
   .withColumn('IsValid', st_isvalid('WKB'))
   .drop("index", "env", 'wkt'))
%%mosaic_kepler
tess_10_env "WKB" "geometry"

image

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant