geodb-rs 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/Cargo.lock +41 -47
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/Cargo.toml +26 -6
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/PKG-INFO +1 -1
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/Cargo.toml +8 -4
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/README.md +150 -21
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/legacy_model/search.rs +20 -8
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/loader/builder.rs +45 -3
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/model/convert.rs +23 -7
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/model/mod.rs +2 -0
- geodb_rs-0.1.6/crates/geodb-core/src/model/query.rs +471 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/model/search.rs +20 -12
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/prelude.rs +1 -1
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/spatial.rs +15 -7
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/traits.rs +2 -1
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-py/Cargo.toml +7 -5
- geodb_rs-0.1.6/crates/geodb-py/geodb_rs_data/geodb.nested.comp.blobs.bin +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-py/src/lib.rs +176 -29
- geodb_rs-0.1.4/crates/geodb-py/geodb_rs_data/city_meta.json +0 -199
- geodb_rs-0.1.4/crates/geodb-py/geodb_rs_data/countries+states+cities.json.gz +0 -0
- geodb_rs-0.1.4/geodb_rs_data/geodb.flat.comp.blobs.bin +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/README.md +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/benches/benchmarks.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/build.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/alias.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/api.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/bin/profile_search.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/common/mod.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/common/raw.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/common/raw_normalize.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/error.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/legacy_model/convert.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/legacy_model/mod.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/legacy_model/nested.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/lib.rs +1 -1
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/loader/binary_load.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/loader/common_io.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/loader/mod.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/model/flat.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/src/text.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/tests/basic.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-core/tests/city_meta_alias_search.rs +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-py/README.md +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-py/example.py +0 -0
- {geodb_rs-0.1.4/crates/geodb-core/data → geodb_rs-0.1.6/crates/geodb-py/geodb_rs_data}/city_meta.json +0 -0
- {geodb_rs-0.1.4/crates/geodb-core/data → geodb_rs-0.1.6/crates/geodb-py/geodb_rs_data}/countries+states+cities.json.gz +0 -0
- {geodb_rs-0.1.4/crates/geodb-core/data → geodb_rs-0.1.6/crates/geodb-py/geodb_rs_data}/geodb.flat.comp.blobs.bin +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/crates/geodb-py/tests/test_basic.py +0 -0
- {geodb_rs-0.1.4/crates/geodb-py → geodb_rs-0.1.6}/geodb_rs_data/geodb.flat.comp.blobs.bin +0 -0
- {geodb_rs-0.1.4 → geodb_rs-0.1.6}/pyproject.toml +0 -0
|
@@ -165,9 +165,9 @@ checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
|
|
|
165
165
|
|
|
166
166
|
[[package]]
|
|
167
167
|
name = "borsh"
|
|
168
|
-
version = "1.
|
|
168
|
+
version = "1.6.0"
|
|
169
169
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
|
-
checksum = "
|
|
170
|
+
checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f"
|
|
171
171
|
dependencies = [
|
|
172
172
|
"cfg_aliases",
|
|
173
173
|
]
|
|
@@ -224,9 +224,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
|
|
224
224
|
|
|
225
225
|
[[package]]
|
|
226
226
|
name = "cc"
|
|
227
|
-
version = "1.2.
|
|
227
|
+
version = "1.2.49"
|
|
228
228
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
229
|
-
checksum = "
|
|
229
|
+
checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215"
|
|
230
230
|
dependencies = [
|
|
231
231
|
"find-msvc-tools",
|
|
232
232
|
"shlex",
|
|
@@ -461,12 +461,6 @@ dependencies = [
|
|
|
461
461
|
"miniz_oxide",
|
|
462
462
|
]
|
|
463
463
|
|
|
464
|
-
[[package]]
|
|
465
|
-
name = "fnv"
|
|
466
|
-
version = "1.0.7"
|
|
467
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
468
|
-
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|
469
|
-
|
|
470
464
|
[[package]]
|
|
471
465
|
name = "form_urlencoded"
|
|
472
466
|
version = "1.2.2"
|
|
@@ -537,7 +531,7 @@ dependencies = [
|
|
|
537
531
|
|
|
538
532
|
[[package]]
|
|
539
533
|
name = "geodb-cli"
|
|
540
|
-
version = "0.1.
|
|
534
|
+
version = "0.1.6"
|
|
541
535
|
dependencies = [
|
|
542
536
|
"anyhow",
|
|
543
537
|
"clap",
|
|
@@ -546,7 +540,7 @@ dependencies = [
|
|
|
546
540
|
|
|
547
541
|
[[package]]
|
|
548
542
|
name = "geodb-core"
|
|
549
|
-
version = "0.1.
|
|
543
|
+
version = "0.1.6"
|
|
550
544
|
dependencies = [
|
|
551
545
|
"bincode",
|
|
552
546
|
"criterion",
|
|
@@ -562,19 +556,20 @@ dependencies = [
|
|
|
562
556
|
|
|
563
557
|
[[package]]
|
|
564
558
|
name = "geodb-ffi"
|
|
565
|
-
version = "0.1.
|
|
559
|
+
version = "0.1.6"
|
|
566
560
|
dependencies = [
|
|
567
561
|
"bincode",
|
|
568
562
|
"flate2",
|
|
569
563
|
"geodb-core",
|
|
570
564
|
"once_cell",
|
|
571
565
|
"serde",
|
|
566
|
+
"serde_json",
|
|
572
567
|
"uniffi",
|
|
573
568
|
]
|
|
574
569
|
|
|
575
570
|
[[package]]
|
|
576
571
|
name = "geodb-py"
|
|
577
|
-
version = "0.1.
|
|
572
|
+
version = "0.1.6"
|
|
578
573
|
dependencies = [
|
|
579
574
|
"geodb-core",
|
|
580
575
|
"pyo3",
|
|
@@ -585,14 +580,14 @@ dependencies = [
|
|
|
585
580
|
|
|
586
581
|
[[package]]
|
|
587
582
|
name = "geodb-rs"
|
|
588
|
-
version = "0.1.
|
|
583
|
+
version = "0.1.6"
|
|
589
584
|
dependencies = [
|
|
590
585
|
"geodb-core",
|
|
591
586
|
]
|
|
592
587
|
|
|
593
588
|
[[package]]
|
|
594
589
|
name = "geodb-wasm"
|
|
595
|
-
version = "0.1.
|
|
590
|
+
version = "0.1.6"
|
|
596
591
|
dependencies = [
|
|
597
592
|
"bincode",
|
|
598
593
|
"console_error_panic_hook",
|
|
@@ -676,12 +671,11 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
|
676
671
|
|
|
677
672
|
[[package]]
|
|
678
673
|
name = "http"
|
|
679
|
-
version = "1.
|
|
674
|
+
version = "1.4.0"
|
|
680
675
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
681
|
-
checksum = "
|
|
676
|
+
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
|
682
677
|
dependencies = [
|
|
683
678
|
"bytes",
|
|
684
|
-
"fnv",
|
|
685
679
|
"itoa",
|
|
686
680
|
]
|
|
687
681
|
|
|
@@ -754,9 +748,9 @@ dependencies = [
|
|
|
754
748
|
|
|
755
749
|
[[package]]
|
|
756
750
|
name = "hyper-util"
|
|
757
|
-
version = "0.1.
|
|
751
|
+
version = "0.1.19"
|
|
758
752
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
759
|
-
checksum = "
|
|
753
|
+
checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
|
|
760
754
|
dependencies = [
|
|
761
755
|
"base64",
|
|
762
756
|
"bytes",
|
|
@@ -948,9 +942,9 @@ dependencies = [
|
|
|
948
942
|
|
|
949
943
|
[[package]]
|
|
950
944
|
name = "libc"
|
|
951
|
-
version = "0.2.
|
|
945
|
+
version = "0.2.178"
|
|
952
946
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
953
|
-
checksum = "
|
|
947
|
+
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
|
|
954
948
|
|
|
955
949
|
[[package]]
|
|
956
950
|
name = "linux-raw-sys"
|
|
@@ -966,9 +960,9 @@ checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
|
|
|
966
960
|
|
|
967
961
|
[[package]]
|
|
968
962
|
name = "log"
|
|
969
|
-
version = "0.4.
|
|
963
|
+
version = "0.4.29"
|
|
970
964
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
971
|
-
checksum = "
|
|
965
|
+
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
|
972
966
|
|
|
973
967
|
[[package]]
|
|
974
968
|
name = "lru-slab"
|
|
@@ -993,9 +987,9 @@ dependencies = [
|
|
|
993
987
|
|
|
994
988
|
[[package]]
|
|
995
989
|
name = "minicov"
|
|
996
|
-
version = "0.3.
|
|
990
|
+
version = "0.3.8"
|
|
997
991
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
998
|
-
checksum = "
|
|
992
|
+
checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d"
|
|
999
993
|
dependencies = [
|
|
1000
994
|
"cc",
|
|
1001
995
|
"walkdir",
|
|
@@ -1019,9 +1013,9 @@ dependencies = [
|
|
|
1019
1013
|
|
|
1020
1014
|
[[package]]
|
|
1021
1015
|
name = "mio"
|
|
1022
|
-
version = "1.1.
|
|
1016
|
+
version = "1.1.1"
|
|
1023
1017
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1024
|
-
checksum = "
|
|
1018
|
+
checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
|
|
1025
1019
|
dependencies = [
|
|
1026
1020
|
"libc",
|
|
1027
1021
|
"wasi",
|
|
@@ -1450,9 +1444,9 @@ dependencies = [
|
|
|
1450
1444
|
|
|
1451
1445
|
[[package]]
|
|
1452
1446
|
name = "rustls-pki-types"
|
|
1453
|
-
version = "1.13.
|
|
1447
|
+
version = "1.13.1"
|
|
1454
1448
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1455
|
-
checksum = "
|
|
1449
|
+
checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c"
|
|
1456
1450
|
dependencies = [
|
|
1457
1451
|
"web-time",
|
|
1458
1452
|
"zeroize",
|
|
@@ -1603,9 +1597,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
|
1603
1597
|
|
|
1604
1598
|
[[package]]
|
|
1605
1599
|
name = "simd-adler32"
|
|
1606
|
-
version = "0.3.
|
|
1600
|
+
version = "0.3.8"
|
|
1607
1601
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1608
|
-
checksum = "
|
|
1602
|
+
checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
|
|
1609
1603
|
|
|
1610
1604
|
[[package]]
|
|
1611
1605
|
name = "siphasher"
|
|
@@ -1677,9 +1671,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
|
|
|
1677
1671
|
|
|
1678
1672
|
[[package]]
|
|
1679
1673
|
name = "syn"
|
|
1680
|
-
version = "2.0.
|
|
1674
|
+
version = "2.0.111"
|
|
1681
1675
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1682
|
-
checksum = "
|
|
1676
|
+
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
|
1683
1677
|
dependencies = [
|
|
1684
1678
|
"proc-macro2",
|
|
1685
1679
|
"quote",
|
|
@@ -1889,9 +1883,9 @@ dependencies = [
|
|
|
1889
1883
|
|
|
1890
1884
|
[[package]]
|
|
1891
1885
|
name = "tower-http"
|
|
1892
|
-
version = "0.6.
|
|
1886
|
+
version = "0.6.8"
|
|
1893
1887
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1894
|
-
checksum = "
|
|
1888
|
+
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
|
|
1895
1889
|
dependencies = [
|
|
1896
1890
|
"bitflags",
|
|
1897
1891
|
"bytes",
|
|
@@ -1919,9 +1913,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
|
|
|
1919
1913
|
|
|
1920
1914
|
[[package]]
|
|
1921
1915
|
name = "tracing"
|
|
1922
|
-
version = "0.1.
|
|
1916
|
+
version = "0.1.43"
|
|
1923
1917
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1924
|
-
checksum = "
|
|
1918
|
+
checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647"
|
|
1925
1919
|
dependencies = [
|
|
1926
1920
|
"pin-project-lite",
|
|
1927
1921
|
"tracing-core",
|
|
@@ -1929,9 +1923,9 @@ dependencies = [
|
|
|
1929
1923
|
|
|
1930
1924
|
[[package]]
|
|
1931
1925
|
name = "tracing-core"
|
|
1932
|
-
version = "0.1.
|
|
1926
|
+
version = "0.1.35"
|
|
1933
1927
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1934
|
-
checksum = "
|
|
1928
|
+
checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c"
|
|
1935
1929
|
dependencies = [
|
|
1936
1930
|
"once_cell",
|
|
1937
1931
|
]
|
|
@@ -2444,9 +2438,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
|
|
|
2444
2438
|
|
|
2445
2439
|
[[package]]
|
|
2446
2440
|
name = "winnow"
|
|
2447
|
-
version = "0.7.
|
|
2441
|
+
version = "0.7.14"
|
|
2448
2442
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2449
|
-
checksum = "
|
|
2443
|
+
checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"
|
|
2450
2444
|
dependencies = [
|
|
2451
2445
|
"memchr",
|
|
2452
2446
|
]
|
|
@@ -2488,18 +2482,18 @@ dependencies = [
|
|
|
2488
2482
|
|
|
2489
2483
|
[[package]]
|
|
2490
2484
|
name = "zerocopy"
|
|
2491
|
-
version = "0.8.
|
|
2485
|
+
version = "0.8.31"
|
|
2492
2486
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2493
|
-
checksum = "
|
|
2487
|
+
checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3"
|
|
2494
2488
|
dependencies = [
|
|
2495
2489
|
"zerocopy-derive",
|
|
2496
2490
|
]
|
|
2497
2491
|
|
|
2498
2492
|
[[package]]
|
|
2499
2493
|
name = "zerocopy-derive"
|
|
2500
|
-
version = "0.8.
|
|
2494
|
+
version = "0.8.31"
|
|
2501
2495
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2502
|
-
checksum = "
|
|
2496
|
+
checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a"
|
|
2503
2497
|
dependencies = [
|
|
2504
2498
|
"proc-macro2",
|
|
2505
2499
|
"quote",
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
|
|
1
2
|
[package]
|
|
2
3
|
name = "geodb-rs"
|
|
3
|
-
version =
|
|
4
|
-
edition =
|
|
4
|
+
version.workspace = true
|
|
5
|
+
edition.workspace = true
|
|
5
6
|
publish = false
|
|
6
|
-
license =
|
|
7
|
+
license.workspace = true
|
|
7
8
|
description = "Workspace crate for geodb-core and geodb-wasm; hosts examples and dev tooling."
|
|
8
|
-
repository =
|
|
9
|
+
repository.workspace = true
|
|
9
10
|
readme = "README.md"
|
|
10
11
|
[workspace]
|
|
11
12
|
members = ["crates/geodb-py"]
|
|
12
13
|
|
|
13
14
|
resolver = "2"
|
|
14
15
|
|
|
16
|
+
[workspace.package]
|
|
17
|
+
version = "0.1.6"
|
|
18
|
+
edition = "2021"
|
|
19
|
+
license = "MIT"
|
|
20
|
+
repository = "https://github.com/holg/geodb-rs"
|
|
21
|
+
authors = ["Holger Trahe"]
|
|
22
|
+
|
|
15
23
|
[workspace.dependencies]
|
|
16
24
|
bincode = "1"
|
|
17
25
|
deunicode = "1.6"
|
|
@@ -22,8 +30,20 @@ serde = { version = "1", features = ["derive"] }
|
|
|
22
30
|
serde-wasm-bindgen = "0.6"
|
|
23
31
|
serde_json = { version = "1" }
|
|
24
32
|
thiserror = "1"
|
|
25
|
-
wasm-bindgen = "0.2"
|
|
26
|
-
web-sys = { version = "0.3", features = [
|
|
33
|
+
wasm-bindgen = "=0.2.105" # Pinned to match trunk 0.21.14's bundled wasm-bindgen-cli
|
|
34
|
+
web-sys = { version = "0.3", features = [
|
|
35
|
+
"console",
|
|
36
|
+
"Window",
|
|
37
|
+
"Document",
|
|
38
|
+
"Location",
|
|
39
|
+
"Element",
|
|
40
|
+
"HtmlElement",
|
|
41
|
+
"HtmlInputElement",
|
|
42
|
+
"Event",
|
|
43
|
+
"EventTarget",
|
|
44
|
+
"UrlSearchParams",
|
|
45
|
+
"CssStyleDeclaration"
|
|
46
|
+
] }
|
|
27
47
|
|
|
28
48
|
[dependencies]
|
|
29
49
|
geodb-core = { path = "crates/geodb-core" }
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "geodb-core"
|
|
3
|
-
version =
|
|
4
|
-
edition =
|
|
5
|
-
authors =
|
|
3
|
+
version.workspace = true
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
authors.workspace = true
|
|
6
6
|
license = "MIT OR Apache-2.0"
|
|
7
7
|
description = "A high-performance geographic database with countries, states, cities, and more"
|
|
8
|
-
repository =
|
|
8
|
+
repository.workspace = true
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
documentation = "https://docs.rs/geodb-core"
|
|
11
11
|
keywords = ["geography", "database", "countries", "cities", "geo"]
|
|
12
12
|
categories = ["database", "data-structures"]
|
|
13
|
+
# Exclude all data files from published package (reduces package to <1MB)
|
|
14
|
+
# Data is automatically downloaded from GitHub on first load
|
|
15
|
+
# Download requires the 'builder' feature (enabled by default)
|
|
16
|
+
exclude = ["data/*.bin", "data/*.json.gz", "data/*.json"]
|
|
13
17
|
|
|
14
18
|
# Configure docs.rs build
|
|
15
19
|
[package.metadata.docs.rs]
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
[](https://pypi.org/project/geodb-rs/)
|
|
21
21
|
[](https://pypi.org/project/geodb-rs/)
|
|
22
22
|
|
|
23
|
+
### pub.dev (Flutter)
|
|
24
|
+
[](https://pub.dev/packages/geodb_flutter)
|
|
25
|
+
[](https://pub.dev/packages/geodb_flutter)
|
|
26
|
+
|
|
23
27
|
### App Store
|
|
24
28
|
[](https://apps.apple.com/app/geodb-rs/id6755972245)
|
|
25
29
|
[](https://testflight.apple.com/join/TuFejJEq)
|
|
@@ -33,6 +37,7 @@ This repository is a **Cargo workspace** containing:
|
|
|
33
37
|
- **`geodb-wasm`** — WebAssembly bindings + browser demo — docs: https://docs.rs/geodb-wasm
|
|
34
38
|
- **`geodb-py`** — Python bindings (published on PyPI as "geodb-rs") — https://pypi.org/project/geodb-rs/
|
|
35
39
|
- **`geodb-ffi`** — FFI bindings for mobile platforms (iOS, macOS, watchOS, Android)
|
|
40
|
+
- **`geodb_flutter`** — Flutter plugin (published on pub.dev) — https://pub.dev/packages/geodb_flutter
|
|
36
41
|
|
|
37
42
|
---
|
|
38
43
|
|
|
@@ -55,13 +60,21 @@ The dataset is adapted from
|
|
|
55
60
|
https://github.com/dr5hn/countries-states-cities-database
|
|
56
61
|
(licensed under **CC-BY-4.0**, attribution required).
|
|
57
62
|
|
|
58
|
-
> Important: Data source
|
|
63
|
+
> **Important: Data source and automatic downloading**
|
|
59
64
|
>
|
|
60
|
-
> geodb-core
|
|
65
|
+
> geodb-core uses the upstream dataset from the dr5hn/countries-states-cities-database repository:
|
|
61
66
|
>
|
|
62
67
|
> https://github.com/dr5hn/countries-states-cities-database/blob/master/json/countries%2Bstates%2Bcities.json.gz
|
|
63
68
|
>
|
|
64
|
-
>
|
|
69
|
+
> **Automatic data download and caching:**
|
|
70
|
+
> - The published crate does NOT include data files (keeps package size under 1MB)
|
|
71
|
+
> - **On first load**, the library automatically downloads the dataset from GitHub (~3.7MB)
|
|
72
|
+
> - After download, a binary cache is generated for fast subsequent loads
|
|
73
|
+
> - Download and cache generation happen only once per system
|
|
74
|
+
> - Requires the `builder` feature (enabled by default) and internet connection for first load
|
|
75
|
+
> - Downloaded data and cache stored in `crates/geodb-core/data/` directory
|
|
76
|
+
>
|
|
77
|
+
> If you update or replace the dataset, ensure it retains the same JSON structure. Please observe the CC-BY-4.0 license and attribution of the upstream project.
|
|
65
78
|
|
|
66
79
|
---
|
|
67
80
|
|
|
@@ -71,14 +84,16 @@ https://github.com/dr5hn/countries-states-cities-database
|
|
|
71
84
|
|
|
72
85
|
```toml
|
|
73
86
|
[dependencies]
|
|
74
|
-
geodb-core = "0.
|
|
87
|
+
geodb-core = "0.1"
|
|
75
88
|
```
|
|
76
89
|
|
|
90
|
+
**Note:** First load will download the dataset from GitHub (~3.7MB) and build the binary cache (requires internet connection). Subsequent loads will be instant using the cached binary.
|
|
91
|
+
|
|
77
92
|
### For WebAssembly (browser/Node)
|
|
78
93
|
|
|
79
94
|
```toml
|
|
80
95
|
[dependencies]
|
|
81
|
-
geodb-wasm = "0.
|
|
96
|
+
geodb-wasm = "0.1"
|
|
82
97
|
```
|
|
83
98
|
|
|
84
99
|
### For Swift (iOS, macOS, watchOS)
|
|
@@ -114,7 +129,25 @@ for city in results {
|
|
|
114
129
|
let nearest = engine.findNearest(lat: 52.52, lng: 13.405, count: 10)
|
|
115
130
|
```
|
|
116
131
|
|
|
117
|
-
### For Android
|
|
132
|
+
### For Flutter (iOS, Android, macOS)
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
# pubspec.yaml
|
|
136
|
+
dependencies:
|
|
137
|
+
geodb_flutter: ^0.1.8
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```dart
|
|
141
|
+
import 'package:geodb_flutter/geodb_flutter.dart';
|
|
142
|
+
|
|
143
|
+
final geodb = GeodbFlutter();
|
|
144
|
+
await geodb.initialize();
|
|
145
|
+
|
|
146
|
+
final results = await geodb.smartSearch('Berlin');
|
|
147
|
+
final nearest = await geodb.findNearest(lat: 52.52, lng: 13.405, count: 10);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### For Android (Kotlin - Native)
|
|
118
151
|
|
|
119
152
|
See the example app in `GeoDB-App/android-app/`. The app uses UniFFI-generated Kotlin bindings.
|
|
120
153
|
|
|
@@ -263,21 +296,46 @@ if let Some(us) = db.find_country_by_iso2("US") {
|
|
|
263
296
|
let countries = db.find_countries_by_phone_code("+44");
|
|
264
297
|
```
|
|
265
298
|
|
|
266
|
-
###
|
|
299
|
+
### Filter-based city search (CityQuery API)
|
|
300
|
+
|
|
301
|
+
Use the chainable `query_cities()` API to disambiguate cities with common names:
|
|
267
302
|
|
|
268
303
|
```rust
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
304
|
+
use geodb_core::prelude::*;
|
|
305
|
+
|
|
306
|
+
let db = GeoDb::<DefaultBackend>::load()?;
|
|
307
|
+
|
|
308
|
+
// Find Springfield in Illinois, US (not the 30+ other Springfields!)
|
|
309
|
+
let results = db.query_cities()
|
|
310
|
+
.filter_country("US")
|
|
311
|
+
.filter_region("Illinois")
|
|
312
|
+
.filter_city("Springfield")
|
|
278
313
|
.collect();
|
|
314
|
+
|
|
315
|
+
assert_eq!(results.len(), 1);
|
|
316
|
+
let (city, state, country) = &results[0];
|
|
317
|
+
println!("{} - {}, {}", city.name(), state.name(), country.iso2());
|
|
318
|
+
// Output: Springfield - Illinois, US
|
|
319
|
+
|
|
320
|
+
// Find Lüdinghausen in NRW (accent-insensitive search)
|
|
321
|
+
let city = db.query_cities()
|
|
322
|
+
.filter_country("DE")
|
|
323
|
+
.filter_region("Nordrhein-Westfalen")
|
|
324
|
+
.filter_city("Ludinghausen") // works without umlaut too
|
|
325
|
+
.first();
|
|
326
|
+
|
|
327
|
+
// Count all Springfields worldwide
|
|
328
|
+
let count = db.query_cities()
|
|
329
|
+
.filter_city("Springfield")
|
|
330
|
+
.count();
|
|
331
|
+
println!("Found {} cities named Springfield", count);
|
|
279
332
|
```
|
|
280
333
|
|
|
334
|
+
Filters support:
|
|
335
|
+
- **Country**: ISO2/ISO3 codes (`"US"`, `"DEU"`) or name substring (`"Germany"`)
|
|
336
|
+
- **Region**: State code (`"CA"`, `"NW"`) or name (`"California"`, `"Nordrhein-Westfalen"`)
|
|
337
|
+
- **City**: Name substring with accent-insensitive matching
|
|
338
|
+
|
|
281
339
|
---
|
|
282
340
|
|
|
283
341
|
# WebAssembly (`geodb-wasm`)
|
|
@@ -316,13 +374,31 @@ Install:
|
|
|
316
374
|
cargo install geodb-cli
|
|
317
375
|
```
|
|
318
376
|
|
|
319
|
-
|
|
377
|
+
Commands:
|
|
320
378
|
|
|
321
379
|
```bash
|
|
322
|
-
geodb-cli --help
|
|
323
|
-
geodb-cli stats
|
|
324
|
-
geodb-cli
|
|
325
|
-
geodb-cli
|
|
380
|
+
geodb-cli --help # Show all commands
|
|
381
|
+
geodb-cli stats # Database statistics
|
|
382
|
+
geodb-cli countries # List all countries
|
|
383
|
+
geodb-cli country US # Lookup country by ISO2/ISO3 code
|
|
384
|
+
geodb-cli states US # List all states for a country
|
|
385
|
+
geodb-cli cities "Springfield" # Search cities by substring
|
|
386
|
+
geodb-cli smart "Berlin" # Smart search (cities/states/countries)
|
|
387
|
+
geodb-cli nearest --lat 52.52 --lng 13.405 -n 5 # Find 5 nearest cities
|
|
388
|
+
geodb-cli radius --lat 52.52 --lng 13.405 -r 50 # Cities within 50km
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Filter-based query (disambiguate cities):
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# Find Springfield in Illinois, US (not the 30+ other Springfields!)
|
|
395
|
+
geodb-cli query --city Springfield --country US --region Illinois
|
|
396
|
+
|
|
397
|
+
# Find Lüdinghausen in NRW, Germany
|
|
398
|
+
geodb-cli query --city "Lüdinghausen" --country DE --region "Nordrhein-Westfalen"
|
|
399
|
+
|
|
400
|
+
# List all cities in Bavaria
|
|
401
|
+
geodb-cli query --country Germany --region Bavaria -n 50
|
|
326
402
|
```
|
|
327
403
|
|
|
328
404
|
Docs.rs: https://docs.rs/geodb-cli
|
|
@@ -365,6 +441,59 @@ print(db.stats()) # (countries, states, cities)
|
|
|
365
441
|
|
|
366
442
|
---
|
|
367
443
|
|
|
444
|
+
# Flutter Plugin (`geodb_flutter`)
|
|
445
|
+
|
|
446
|
+
Cross-platform Flutter plugin with native Rust performance.
|
|
447
|
+
|
|
448
|
+
### pub.dev
|
|
449
|
+
[](https://pub.dev/packages/geodb_flutter)
|
|
450
|
+
|
|
451
|
+
### Installation
|
|
452
|
+
|
|
453
|
+
```yaml
|
|
454
|
+
dependencies:
|
|
455
|
+
geodb_flutter: ^0.1.8
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Platform Support
|
|
459
|
+
|
|
460
|
+
| Platform | Status | Architectures |
|
|
461
|
+
|----------|--------|---------------|
|
|
462
|
+
| iOS | Ready | arm64 device, arm64 simulator |
|
|
463
|
+
| macOS | Ready | arm64, x86_64 (Universal) |
|
|
464
|
+
| Android | Ready | arm64-v8a, armeabi-v7a, x86_64, x86 |
|
|
465
|
+
|
|
466
|
+
### Quick Start
|
|
467
|
+
|
|
468
|
+
```dart
|
|
469
|
+
import 'package:geodb_flutter/geodb_flutter.dart';
|
|
470
|
+
|
|
471
|
+
final geodb = GeodbFlutter();
|
|
472
|
+
|
|
473
|
+
// Initialize (required first)
|
|
474
|
+
await geodb.initialize();
|
|
475
|
+
|
|
476
|
+
// Get stats
|
|
477
|
+
final stats = await geodb.getStats();
|
|
478
|
+
print('${stats.cities} cities in ${stats.countries} countries');
|
|
479
|
+
|
|
480
|
+
// Smart search
|
|
481
|
+
final results = await geodb.smartSearch('Berlin');
|
|
482
|
+
for (final city in results) {
|
|
483
|
+
print('${city.name}, ${city.country} (${city.iso2})');
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// Find nearest cities
|
|
487
|
+
final nearest = await geodb.findNearest(lat: 52.52, lng: 13.405, count: 10);
|
|
488
|
+
|
|
489
|
+
// Search within radius
|
|
490
|
+
final nearby = await geodb.findInRadius(lat: 52.52, lng: 13.405, radiusKm: 50.0);
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
For a complete example, see `GeoDB-Apps/geodb_city_autocomplete/` in the repository.
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
368
497
|
# Mobile Apps (`GeoDB-App`)
|
|
369
498
|
|
|
370
499
|
The repository includes native apps for Apple and Android platforms:
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// crates/geodb-core/src/legacy_model/search.rs
|
|
2
2
|
|
|
3
|
-
use crate::traits::CityContext;
|
|
4
3
|
use crate::alias::CityMetaIndex;
|
|
5
4
|
use crate::common::{DbStats, SmartHitGeneric};
|
|
6
5
|
use crate::legacy_model::nested::{City, Country, GeoDb, State};
|
|
7
|
-
use crate::spatial::{decode_geoid,
|
|
6
|
+
use crate::spatial::{decode_geoid, distance_squared, haversine_distance};
|
|
8
7
|
#[allow(unused_imports)]
|
|
9
8
|
use crate::text::{fold_key, match_score};
|
|
9
|
+
use crate::traits::CityContext;
|
|
10
10
|
use crate::traits::{GeoBackend, GeoSearch};
|
|
11
11
|
use std::collections::HashSet;
|
|
12
12
|
type MySmartHit<'a, B> = SmartHitGeneric<'a, Country<B>, State<B>, City<B>>;
|
|
@@ -495,7 +495,7 @@ impl<B: GeoBackend> GeoSearch<B> for GeoDb<B> {
|
|
|
495
495
|
}
|
|
496
496
|
None
|
|
497
497
|
}
|
|
498
|
-
fn find_nearest(&self, lat: f64, lng: f64, count: usize) -> Vec
|
|
498
|
+
fn find_nearest(&self, lat: f64, lng: f64, count: usize) -> Vec<CityContext<'_, B>> {
|
|
499
499
|
// Legacy: We don't have a spatial_index, so we must scan the whole world.
|
|
500
500
|
// This is slower (O(N)), but correct.
|
|
501
501
|
|
|
@@ -509,7 +509,7 @@ impl<B: GeoBackend> GeoSearch<B> for GeoDb<B> {
|
|
|
509
509
|
|
|
510
510
|
// Squared Euclidean for fast sorting
|
|
511
511
|
let dist = distance_squared(lat, lng, c_lat, c_lng);
|
|
512
|
-
candidates.push((dist, city));
|
|
512
|
+
candidates.push((dist, city, state, country));
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
}
|
|
@@ -518,14 +518,22 @@ impl<B: GeoBackend> GeoSearch<B> for GeoDb<B> {
|
|
|
518
518
|
candidates.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());
|
|
519
519
|
|
|
520
520
|
// Take top N
|
|
521
|
-
candidates
|
|
521
|
+
candidates
|
|
522
|
+
.into_iter()
|
|
523
|
+
.take(count)
|
|
524
|
+
.map(|(_, c, s, co)| (c, s, co))
|
|
525
|
+
.collect()
|
|
522
526
|
}
|
|
523
527
|
|
|
524
528
|
// crates/geodb-core/src/model/search.rs
|
|
525
529
|
|
|
526
530
|
// crates/geodb-core/src/legacy_model/search.rs
|
|
527
531
|
|
|
528
|
-
fn find_cities_in_radius_by_geoid(
|
|
532
|
+
fn find_cities_in_radius_by_geoid(
|
|
533
|
+
&self,
|
|
534
|
+
geoid: u64,
|
|
535
|
+
radius_km: f64,
|
|
536
|
+
) -> Vec<CityContext<'_, B>> {
|
|
529
537
|
let (center_lat, center_lng) = decode_geoid(geoid);
|
|
530
538
|
|
|
531
539
|
// BBox calc (Same as above)
|
|
@@ -556,8 +564,12 @@ impl<B: GeoBackend> GeoSearch<B> for GeoDb<B> {
|
|
|
556
564
|
}
|
|
557
565
|
}
|
|
558
566
|
|
|
559
|
-
candidates
|
|
560
|
-
|
|
567
|
+
candidates
|
|
568
|
+
.sort_unstable_by(|a, b| a.0.partial_cmp(&b.0).unwrap_or(std::cmp::Ordering::Equal));
|
|
569
|
+
candidates
|
|
570
|
+
.into_iter()
|
|
571
|
+
.map(|(_, city, state, country)| (city, state, country))
|
|
572
|
+
.collect()
|
|
561
573
|
}
|
|
562
574
|
|
|
563
575
|
// ... (Ensure enrich_with_city_meta is present as a no-op or todo) ...
|