Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么我用相同的纬度和经度得到不同的h3指数_Python_C_H3 - Fatal编程技术网

Python 为什么我用相同的纬度和经度得到不同的h3指数

Python 为什么我用相同的纬度和经度得到不同的h3指数,python,c,h3,Python,C,H3,我正在使用SQlite六边形索引数据库和其他信息,六边形索引是主键。该数据库由python编写的代码生成,其他用C编写的代码使用六边形索引访问存储在数据库中的信息 for res_hex in [12,11,10,9,8]: index_hex = h3.geo_to_h3(sonde[1], sonde[0], res_hex) 探空仪[1]为纬度,探空仪[0]为经度,分辨率为十六进制 事实上,我在一个文本文件中有一个由纬度和经度表示的对象列表,我用不同的分辨率(8到

我正在使用SQlite六边形索引数据库和其他信息,六边形索引是主键。该数据库由python编写的代码生成,其他用C编写的代码使用六边形索引访问存储在数据库中的信息

for res_hex in [12,11,10,9,8]:
            index_hex = h3.geo_to_h3(sonde[1], sonde[0], res_hex)
探空仪[1]为纬度,探空仪[0]为经度,分辨率为十六进制

事实上,我在一个文本文件中有一个由纬度和经度表示的对象列表,我用不同的分辨率(8到12)计算它们周围的索引。我输入了数据库

for res_hex in [12,11,10,9,8]:
            index_hex = h3.geo_to_h3(sonde[1], sonde[0], res_hex)
但我的问题是,当我用lat,lon和分辨率计算代码c中的六边形时,我在基部找不到它。即使计算基于同一文件,也会发生这种情况

GeoCoord geo = {latitude, longitude};
H3Index currentIndex = geoToH3(&geo, resolution);

感谢您的帮助

我找到了一个解决方案,在C Lat/Lon中必须是弧度,但在python中不是这样的

我还想知道k环函数返回模式1和模式2索引之间的哪一个。您所说的“模式1”和“模式2”是什么意思?如果你是指索引的模式位,k环函数总是返回单元格(
H3_HEXAGON_mode
),而不是边。事实上,我希望十六进制在给定的方向上有相邻的十六进制。k环函数不能保证环内的顺序,如果这回答了你的问题,有什么方法可以对它们进行排序吗?这是正确的-在C中,输入以弧度为单位,但在各种绑定中,输入通常为lat/long。