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
+
|
| 9 |
+
A simple parquet conversion of the tab-separated, zipped textfile from https://download.geonames.org/export/dump/ allCountries.zip.
|
| 10 |
+
|
| 11 |
+
## Columns
|
| 12 |
+
|
| 13 |
+
allCountries.zip
|
| 14 |
+
|
| 15 |
+
```
|
| 16 |
+
The main 'geoname' table has the following fields :
|
| 17 |
+
---------------------------------------------------
|
| 18 |
+
geonameid : integer id of record in geonames database
|
| 19 |
+
name : name of geographical point (utf8) varchar(200)
|
| 20 |
+
asciiname : name of geographical point in plain ascii characters, varchar(200)
|
| 21 |
+
alternatenames : alternatenames, comma separated, ascii names automatically transliterated, convenience attribute from alternatename table, varchar(10000)
|
| 22 |
+
latitude : latitude in decimal degrees (wgs84)
|
| 23 |
+
longitude : longitude in decimal degrees (wgs84)
|
| 24 |
+
feature class : see http://www.geonames.org/export/codes.html, char(1)
|
| 25 |
+
feature code : see http://www.geonames.org/export/codes.html, varchar(10)
|
| 26 |
+
country code : ISO-3166 2-letter country code, 2 characters
|
| 27 |
+
cc2 : alternate country codes, comma separated, ISO-3166 2-letter country code, 200 characters
|
| 28 |
+
admin1 code : fipscode (subject to change to iso code), see exceptions below, see file admin1Codes.txt for display names of this code; varchar(20)
|
| 29 |
+
admin2 code : code for the second administrative division, a county in the US, see file admin2Codes.txt; varchar(80)
|
| 30 |
+
admin3 code : code for third level administrative division, varchar(20)
|
| 31 |
+
admin4 code : code for fourth level administrative division, varchar(20)
|
| 32 |
+
population : bigint (8 byte int)
|
| 33 |
+
elevation : in meters, integer
|
| 34 |
+
dem : digital elevation model, srtm3 or gtopo30, average elevation of 3''x3'' (ca 90mx90m) or 30''x30'' (ca 900mx900m) area in meters, integer. srtm processed by cgiar/ciat.
|
| 35 |
+
timezone : the iana timezone id (see file timeZone.txt) varchar(40)
|
| 36 |
+
modification date : date of last modification in yyyy-MM-dd format
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Conversion
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import pandas as pd
|
| 43 |
+
df = pd.read_csv('allCountries.txt', sep='\t', header=None, low_memory=False)
|
| 44 |
+
df.to_parquet('geonames_23_03_2025.parquet')
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
## Quality
|
| 48 |
+
|
| 49 |
+
Be warned, the quality - especially for other languages than English - might sometimes be low. Sometimes there are duplicates and very confusing entries.
|
| 50 |
+
|
| 51 |
+
## Query with DuckDB
|
| 52 |
+
|
| 53 |
+
### Example query for `München`
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import duckdb
|
| 57 |
+
import geopandas
|
| 58 |
+
df = duckdb.sql(f"SELECT * FROM 'geonames_23_03_2025.parquet' WHERE \"1\" = 'München' ").df() # you can add the country code to the query with AND \"8\" = 'GB'
|
| 59 |
+
gdf = geopandas.GeoDataFrame( df, geometry=geopandas.points_from_xy(x=df["5"], y=df["4"]))
|
| 60 |
+
gdf
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
| ID | Name | Alternate Name | Additional Info | Latitude | Longitude | Feature Class | Feature Code | Country Code | Admin Code | Admin1 | Admin2 | Admin3 | Admin4 | Population | Elevation | Time Zone | Last Update | Geometry |
|
| 64 |
+
|---------|---------|---------------|----------------|-----------|-----------|---------------|--------------|--------------|------------|--------|--------|---------|----------|------------|-----------|---------------|--------------|------------------------|
|
| 65 |
+
| 2867711 | München | Muenchen | None | 51.60698 | 13.31243 | P | PPL | DE | None | 11 | 00 | 12062 | 12062500 | 0 | NaN | Europe/Berlin | 2015-09-04 | POINT (13.312 51.607) |
|
| 66 |
+
| 2867713 | München | Munchen | None | 48.69668 | 13.46314 | P | PPL | DE | None | 02 | 092 | 09275 | 09275128 | 0 | NaN | Europe/Berlin | 2013-02-19 | POINT (13.463 48.697) |
|
| 67 |
+
|
| 68 |
+
Note that using the German spelling the query yields nonsense. Instead, query in English:
|
| 69 |
+
|
| 70 |
+
```python
|
| 71 |
+
import duckdb
|
| 72 |
+
import geopandas
|
| 73 |
+
df = duckdb.sql(f"SELECT * FROM 'geonames_23_03_2025.parquet' WHERE \"1\" = 'Munich' AND \"8\" = 'DE' ").df() # you can add the country code to the query with AND \"8\" = 'GB'
|
| 74 |
+
gdf = geopandas.GeoDataFrame( df, geometry=geopandas.points_from_xy(x=df["5"], y=df["4"]))
|
| 75 |
+
gdf
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
| ID | Name | Official Name | Alternate Names | Latitude | Longitude | Feature Class | Feature Code | Country Code | Admin Code | Admin1 | Admin2 | Admin3 | Admin4 | Population | Elevation | Time Zone | Last Update | Geometry |
|
| 79 |
+
|---------|--------|--------------|-----------------|-----------|-----------|---------------|--------------|--------------|------------|--------|--------|---------|----------|------------|-----------|--------------|--------------|------------------------|
|
| 80 |
+
| 2867714 | Munich | Munich | Lungsod ng Muenchen, Lungsod ng München, MUC, Min... | 48.13743 | 11.57549 | P | PPLA | DE | None | 02 | 091 | 09162 | 09162000 | 1260391 | NaN | 524 | Europe/Berlin | 2023-10-12 | POINT (11.575 48.137) |
|
| 81 |
+
|
| 82 |
+
This query returns only one entry with a city centroid, just as expected.
|
| 83 |
+
|
| 84 |
+
## Visualize with deck.gl
|
| 85 |
+
|
| 86 |
+
```python
|
| 87 |
+
import pydeck as pdk
|
| 88 |
+
import pandas as pd
|
| 89 |
+
import numpy as np
|
| 90 |
+
|
| 91 |
+
# load some gdf
|
| 92 |
+
gdf["coordinates"] = gdf.apply(lambda x: [x.geometry.x, x.geometry.y], axis=1)
|
| 93 |
+
|
| 94 |
+
# Define a layer to display on a map
|
| 95 |
+
layer = pdk.Layer(
|
| 96 |
+
"ScatterplotLayer",
|
| 97 |
+
# coordinates is an array
|
| 98 |
+
gdf[["1","coordinates"]], # super important! only pass what's needed. If geometry column from geopandas is passed, error!
|
| 99 |
+
pickable=True,
|
| 100 |
+
opacity=0.99,
|
| 101 |
+
stroked=True,
|
| 102 |
+
filled=True,
|
| 103 |
+
radius_scale=6,
|
| 104 |
+
radius_min_pixels=1,
|
| 105 |
+
radius_max_pixels=100,
|
| 106 |
+
line_width_min_pixels=1,
|
| 107 |
+
get_position="coordinates",
|
| 108 |
+
get_radius="1000",
|
| 109 |
+
get_fill_color=[255, 140, 0],
|
| 110 |
+
get_line_color=[255, 140, 0],
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
+
# Set the viewport location
|
| 114 |
+
view_state = pdk.ViewState(latitude=np.mean(gdf.geometry.y), longitude=np.mean(gdf.geometry.x), zoom=12, bearing=0, pitch=0)
|
| 115 |
+
|
| 116 |
+
# Render
|
| 117 |
+
r = pdk.Deck(layers=[layer], initial_view_state=view_state,height=2000, tooltip={"text": "{1}"})
|
| 118 |
+
r.to_html("scatterplot_layer.html")
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
|
| 123 |
+
## Sample
|
| 124 |
+
|
| 125 |
+
| ID | Name | Official Name | Alternate Names | Latitude | Longitude | Feature Class | Feature Code | Country Code | Admin Code | Admin1 | Admin2 | Admin3 | Admin4 | Population | Elevation | Time Zone | Last Update |
|
| 126 |
+
|----------|-------------------------------|------------------------------------|-------------------------------------------------|-----------|-----------|---------------|--------------|--------------|------------|--------|--------|--------|--------|------------|-----------|---------------|--------------|
|
| 127 |
+
| 2994701 | Roc Meler | Roc Meler | Roc Mele, Roc Meler, Roc Mélé | 42.58765 | 1.74180 | T | PK | AD | AD,FR | 02 | NaN | NaN | NaN | 0 | 2811 | Europe/Andorra | 2023-10-03 |
|
| 128 |
+
| 3017832 | Pic de les Abelletes | Pic de les Abelletes | Pic de la Font-Negre, Pic de la Font-Nègre, Pic ... | 42.52535 | 1.73343 | T | PK | AD | FR | A9 | 66 | 663 | 66146 | 0 | NaN | 2411 | Europe/Andorra | 2014-11-05 |
|
| 129 |
+
| 3017833 | Estany de les Abelletes | Estany de les Abelletes | Estany de les Abelletes, Etang de Font-Negre, Ét... | 42.52915 | 1.73362 | H | LK | AD | FR | A9 | NaN | NaN | NaN | 0 | NaN | 2260 | Europe/Andorra | 2014-11-05 |
|
| 130 |
+
| 3023203 | Port Vieux de la Coume d’Ose | Port Vieux de la Coume d'Ose | Port Vieux de Coume d'Ose, Port Vieux de Coume ... | 42.62568 | 1.61823 | T | PASS | AD | NaN | 00 | NaN | NaN | NaN | 0 | NaN | 2687 | Europe/Andorra | 2014-11-05 |
|
| 131 |
+
| 3029315 | Port de la Cabanette | Port de la Cabanette | Port de la Cabanette, Porteille de la Cabanette | 42.60000 | 1.73333 | T | PASS | AD | AD,FR | B3 | 09 | 091 | 09139 | 0 | NaN | 2379 | Europe/Andorra | 2014-11-05 |
|
| 132 |
+
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
|
| 133 |
+
| 13216940 | GLORIA Seamount | GLORIA Seamount | NaN | 45.03000 | -15.53500 | U | SMU | NaN | NaN | 00 | NaN | NaN | NaN | 0 | NaN | -9999 | NaN | 2025-02-19 |
|
| 134 |
+
| 13216941 | Yubko Hills | Yubko Hills | NaN | 13.01820 | -134.41130 | U | HLSU | NaN | NaN | 00 | NaN | NaN | NaN | 0 | NaN | -9999 | NaN | 2025-02-19 |
|
| 135 |
+
| 13216942 | Maguari Seamount | Maguari Seamount | NaN | 0.68832 | -44.31278 | U | SMU | NaN | NaN | 00 | NaN | NaN | NaN | 0 | NaN | -9999 | NaN | 2025-02-19 |
|
| 136 |
+
| 13216943 | Quintana Seamount | Quintana Seamount | NaN | -32.74950 | -38.67696 | U | SMU | NaN | NaN | 00 | NaN | NaN | NaN | 0 | NaN | -9999 | NaN | 2025-02-19 |
|
| 137 |
+
| 13216944 | Satander Guyot | Satander Guyot | NaN | -1.92806 | -37.82161 | U | DEPU | NaN | NaN | 00 | NaN | NaN | NaN | 0 | NaN | -9999 | NaN | 2025-02-19 |
|
| 138 |
+
|
| 139 |
+
13111559 rows × 19 columns
|