我有带有地理位置的Flutter应用。我用这个plugin。
根据坐标,我需要确定国家。我可以为此使用插件。当有互联网时,它可以工作。但是,当互联网不可用时,我还需要确定国家/地区。我只找到一种解决方案:
与主要城市的协调员一起导入数据库,并根据它们确定国家。
也许有一个更简单的解决方案?
最佳答案
使用geohash
void main() {
GeoHasher geoHasher = GeoHasher();
// country level precision: 10
myGeoCountryLevelCoord := geoHasher.encode(-98, 38, precision: 10);
// now you need to download countries geohashes and match it, won't be many, small file only
}
检查countries global geohash map