PBF File Readerยถ
PBFFileReader
can really quickly parse full OSM extract in the form of *.osm.pbf
file.
It uses DuckDB
with spatial
extension to convert pbf
files into geoparquet
files without GDAL dependency.
Reader can filter objects by geometry and by OSM tags with option to split tags into columns or keep it as a single dictionary.
Caching strategy is implemented to reduce computations, but it can be overriden using ignore_cache
parameter.
Download all buildings in Reykjavรญk, Icelandยถ
Filtering the data with geometry and by tags, with tags in exploded form
import urllib.request
from quackosm import PbfFileReader, geocode_to_geometry
iceland_pbf_url = "https://download.geofabrik.de/europe/iceland-latest.osm.pbf"
iceland_pbf_file = "iceland.osm.pbf"
urllib.request.urlretrieve(iceland_pbf_url, iceland_pbf_file)
('iceland.osm.pbf', <http.client.HTTPMessage at 0x7fdf302cc040>)
reykjavik_geometry = geocode_to_geometry("Reykjavรญk, IS")
reykjavik_geometry
To filter out buildings, we will utilize format used also in the osmnx
library: a dictionary with keys representing tag keys and values that could be a bool, string or a list of string.
By default, QuackOSM
will return only the tags that are present in the passed filter.
In this example we will select all the buildings using { "building": True }
filter and only building
tag values will be present in the result.
reader = PbfFileReader(
geometry_filter=reykjavik_geometry, tags_filter={"building": True}
)
reykjavik_buildings_gpq = reader.convert_pbf_to_parquet("iceland.osm.pbf")
reykjavik_buildings_gpq
Finished operation in 0:00:50
PosixPath('files/iceland_ae99e3d9_f2f6702e_exploded.parquet')
Read those features using DuckDBยถ
import duckdb
connection = duckdb.connect()
connection.load_extension("parquet")
connection.load_extension("spatial")
features_relation = connection.read_parquet(str(reykjavik_buildings_gpq))
features_relation
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ feature_id โ building โ geometry โ โ varchar โ varchar โ geometry โ โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ node/2975118984 โ yes โ POINT (-21.7832872 64.1364481) โ โ way/516193601 โ yes โ POLYGON ((-21.9309649 64.1293002, -21.9309693 64.129321, -21.930907 64.1293235, -21.9308935 64.1293185, -21.9307978 64.129283, -21.930774 64.1292742, -21.9307271 64.129055, -21.9308431 64.1290503, -21.9308363 64.1290182, -21.9313146 64.1289987, -21.9313302 64.1290717, -21.9314664 64.1290662, -21.9315116 64.1292779, -21.9309649 64.1293002)) โ โ way/516202862 โ commercial โ POLYGON ((-21.7747343 64.1033863, -21.7745445 64.1032489, -21.7739753 64.1033639, -21.7739958 64.1033888, -21.7738912 64.1034058, -21.7738616 64.1033712, -21.7727619 64.1034831, -21.7727579 64.1036746, -21.7729564 64.1036606, -21.7732005 64.1036406, -21.7734553 64.1036143, -21.7736873 64.1035862, -21.7739502 64.1035481, -21.7739354 64.1035129, -21.7740762 64.1034883, -21.7741151 64.1035399, -21.7743337 64.1034948, -21.7745376 64.1034421, -21.7747343 64.1033863)) โ โ way/541682022 โ apartments โ POLYGON ((-21.9122134 64.1350499, -21.9118813 64.1349992, -21.91195 64.1349136, -21.9121251 64.1349404, -21.9121392 64.1349228, -21.912229 64.1349365, -21.9122175 64.1349508, -21.9122847 64.1349611, -21.9122134 64.1350499)) โ โ way/541682023 โ apartments โ POLYGON ((-21.9125905 64.1351085, -21.9126649 64.1350165, -21.9125484 64.1349986, -21.912561 64.134983, -21.9124578 64.1349671, -21.9124436 64.1349847, -21.9122847 64.1349611, -21.9122134 64.1350499, -21.9125905 64.1351085)) โ โ way/541765751 โ yes โ POLYGON ((-21.8048845 64.2238923, -21.8049378 64.2239247, -21.8048157 64.2239627, -21.8047625 64.2239302, -21.8048845 64.2238923)) โ โ way/541765752 โ yes โ POLYGON ((-21.8047464 64.2239034, -21.8045851 64.2239601, -21.8044603 64.223893, -21.8046216 64.2238363, -21.8047464 64.2239034)) โ โ way/541765753 โ yes โ POLYGON ((-21.7953902 64.2221819, -21.7953069 64.2222317, -21.7951299 64.2221757, -21.7952131 64.2221259, -21.7953902 64.2221819)) โ โ way/541765754 โ yes โ POLYGON ((-21.7917305 64.2228264, -21.7915835 64.2229097, -21.7911785 64.2227744, -21.7913255 64.2226911, -21.7917305 64.2228264)) โ โ way/542159663 โ yes โ POLYGON ((-21.6739386 64.1931624, -21.6737786 64.1931721, -21.673741 64.1930554, -21.6739011 64.1930456, -21.6739386 64.1931624)) โ โ ยท โ ยท โ ยท โ โ ยท โ ยท โ ยท โ โ ยท โ ยท โ ยท โ โ way/283965261 โ yes โ POLYGON ((-21.8506568 64.2408213, -21.8507447 64.2406873, -21.8504954 64.2406564, -21.8504865 64.2406699, -21.8503642 64.2406548, -21.8503003 64.2407522, -21.8504372 64.2407692, -21.8504221 64.2407923, -21.8506568 64.2408213)) โ โ way/284120323 โ yes โ POLYGON ((-21.806237 64.2322953, -21.8063422 64.2322116, -21.8060166 64.2321342, -21.8059114 64.2322178, -21.806237 64.2322953)) โ โ way/284120326 โ yes โ POLYGON ((-21.8161663 64.2431488, -21.8152194 64.2419142, -21.8148486 64.2419679, -21.8157954 64.2432025, -21.8161663 64.2431488)) โ โ way/284120329 โ yes โ POLYGON ((-21.7736061 64.2180076, -21.7737111 64.2179469, -21.7735672 64.2178998, -21.773627 64.2178652, -21.7734772 64.2178162, -21.7734298 64.2178436, -21.7733689 64.2178237, -21.7734206 64.2177938, -21.7731897 64.2177183, -21.772871 64.2179026, -21.7729661 64.2179337, -21.7730132 64.2179065, -21.7731623 64.2179552, -21.7732732 64.2178911, -21.7734599 64.2179522, -21.7732801 64.2180562, -21.7734347 64.2181067, -21.7736061 64.2180076)) โ โ way/284120335 โ yes โ POLYGON ((-21.8195166 64.237606, -21.8196993 64.2374896, -21.8196383 64.2374716, -21.8197145 64.237423, -21.8195465 64.2373731, -21.8194522 64.2374332, -21.8193117 64.2373916, -21.819147 64.2374965, -21.8195166 64.237606)) โ โ way/284120337 โ yes โ POLYGON ((-21.8135426 64.2415588, -21.8136984 64.2415035, -21.8134315 64.2413616, -21.8132758 64.2414169, -21.8135426 64.2415588)) โ โ way/284120348 โ yes โ POLYGON ((-21.7740448 64.2185202, -21.7742955 64.2183957, -21.773999 64.2182828, -21.7738393 64.2183621, -21.773539 64.2182477, -21.773448 64.2182929, -21.7740448 64.2185202)) โ โ way/284120349 โ yes โ POLYGON ((-21.8048206 64.2323031, -21.804913 64.232219, -21.8047068 64.2321762, -21.8046145 64.2322603, -21.8048206 64.2323031)) โ โ way/284120352 โ yes โ POLYGON ((-21.8135638 64.2416305, -21.8133323 64.2415156, -21.8132126 64.2415612, -21.8134441 64.2416761, -21.8135638 64.2416305)) โ โ way/284120354 โ yes โ POLYGON ((-21.8060297 64.2327885, -21.8063665 64.2325203, -21.8061819 64.2324765, -21.8060246 64.2326018, -21.805873 64.2325658, -21.8056935 64.2327087, -21.8060297 64.2327885)) โ โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ ? rows (>9999 rows, 20 shown) 3 columns โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Count all buildingsยถ
features_relation.count("feature_id")
โโโโโโโโโโโโโโโโโโโโโ โ count(feature_id) โ โ int64 โ โโโโโโโโโโโโโโโโโโโโโค โ 25385 โ โโโโโโโโโโโโโโโโโโโโโ
Keeping all the tags while filtering the dataยถ
To keep all of the tags present in the source data, we can use keep_all_tags
parameter. That way we will still return only buildings, but with all of the tags attached.
By default, all of those tags will be kept in a single column as a dict
.
reader.convert_pbf_to_geodataframe("iceland.osm.pbf", keep_all_tags=True)
Finished operation in 0:00:39
tags | geometry | |
---|---|---|
feature_id | ||
node/2710083164 | {'building': 'yes'} | POINT (-21.91402 64.14526) |
node/2975118984 | {'addr:housenumber': '85b', 'addr:postcode': '... | POINT (-21.78329 64.13645) |
way/537108892 | {'addr:housenumber': '2A', 'addr:postcode': '1... | POLYGON ((-21.88989 64.1197, -21.89003 64.1197... |
way/537108895 | {'addr:housenumber': '2', 'addr:postcode': '10... | POLYGON ((-21.89148 64.11973, -21.89148 64.119... |
way/537108898 | {'addr:city': 'Reykjavรญk', 'addr:housenumber':... | POLYGON ((-21.89552 64.12012, -21.89552 64.120... |
... | ... | ... |
way/1292933047 | {'building': 'yes'} | POLYGON ((-21.69278 64.19936, -21.69278 64.199... |
way/1292933048 | {'building': 'yes'} | POLYGON ((-21.69426 64.19957, -21.69525 64.199... |
way/1292933051 | {'building': 'yes'} | POLYGON ((-21.69305 64.19806, -21.69281 64.197... |
way/1292933052 | {'addr:housenumber': '5', 'addr:postcode': '16... | POLYGON ((-21.69576 64.19678, -21.69634 64.196... |
way/1292933053 | {'addr:housenumber': '5A', 'addr:postcode': '1... | POLYGON ((-21.69607 64.19691, -21.69665 64.196... |
25385 rows ร 2 columns
Download main roads for Estoniaยถ
Filtering the data only by tags, with tags in exploded form
highways_filter = {
"highway": [
"motorway",
"trunk",
"primary",
"secondary",
"tertiary",
]
}
estonia_pbf_url = "http://download.geofabrik.de/europe/estonia-latest.osm.pbf"
estonia_pbf_file = "estonia.osm.pbf"
urllib.request.urlretrieve(estonia_pbf_url, estonia_pbf_file)
reader = PbfFileReader(geometry_filter=None, tags_filter=highways_filter)
estonia_features_gpq = reader.convert_pbf_to_parquet(estonia_pbf_file)
estonia_features_gpq
Finished operation in 0:01:48
PosixPath('files/estonia_87e7b741_noclip_exploded.parquet')
features_relation = connection.read_parquet(str(estonia_features_gpq))
features_relation
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ feature_id โ highway โ geometry โ โ varchar โ varchar โ geometry โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ way/120919682 โ tertiary โ LINESTRING (24.7184995 59.2317397, 24.7184802 59.2315726, 24.7183972 59.2313673, 24.7183493 59.2313024, 24.71829 59.231222, 24.7181676 59.2311144, 24.7180784 59.2310525, 24.7179549 59.2309668, 24.7178168 59.2308911, 24.7174345 59.2307143, 24.7169891 59.2305156, 24.7165636 59.2303282, 24.7163085 59.2302159, 24.7160455 59.2301058, 24.7159299 59.2300602, 24.7158525 59.2300263, 24.7152366 59.2297439, 24.7147146 59.2295121, 24.7144654 59.2294039, 24.7143563 59.2293741, 24.7142401 59.2293444, 24.7141129 59.2293268, 24.7139703 59.2293153, 24.7137226 59.2293165, 24.7130947 59.2293597, 24.7127274 59.2293821, 24.7121497 59.2294175, 24.7115402 59.2294548, 24.7112841 59.2294618, 24.7110468 59.2294647, 24.7109749 59.2294636, 24.7105352 59.2294449, 24.7100411 59.2294181, 24.7097062 59.2293926, 24.7087757 59.2293217, 24.7083799 59.2293171, 24.708165 59.2293254, 24.7079324 59.2293583, 24.7077756 59.2293892, 24.7076386 59.2294289, 24.7075207 59.229466, 24.7074182 59.2295092, 24.7073021 59.2295652, 24.7071588 59.2296439) โ โ way/120921035 โ tertiary โ LINESTRING (24.7504925 59.2442251, 24.7504176 59.244171, 24.7503642 59.2440976, 24.7503694 59.2440174, 24.75041 59.2439383, 24.7505306 59.2437425, 24.75088 59.2430053, 24.7513247 59.2418552, 24.7517024 59.240976, 24.7519192 59.2405759, 24.752265 59.2400109, 24.7526732 59.2394937, 24.7530342 59.2391163, 24.7534655 59.238739, 24.7535614 59.2386687, 24.7543761 59.2380716, 24.7560422 59.2369191, 24.7570155 59.2362458, 24.7577835 59.235822, 24.7589507 59.2352838, 24.7599909 59.2348816, 24.761394 59.2344454, 24.7617739 59.234356, 24.7623022 59.2342317, 24.7633553 59.2339847, 24.7652319 59.2335445, 24.7707377 59.2322799, 24.7712215 59.2322118, 24.7715354 59.2323156) โ โ way/120921038 โ tertiary โ LINESTRING (24.7652319 59.2335445, 24.7650396 59.2333501, 24.7647681 59.2331374, 24.7645931 59.2330181, 24.7643925 59.2328616, 24.7642231 59.2326892, 24.7640129 59.2323962, 24.7638967 59.2322898, 24.7638782 59.2322776, 24.7637259 59.2321775, 24.7630998 59.2317722, 24.7622699 59.231235, 24.761798 59.2309012, 24.7617178 59.2308453, 24.7616254 59.2307948, 24.7615354 59.2307588, 24.7614388 59.230725, 24.7611763 59.230668, 24.759628 59.2304057, 24.7592609 59.2303143, 24.7589021 59.2302082, 24.7588091 59.2301715, 24.7586347 59.2301028, 24.7581517 59.2299, 24.7574407 59.229534, 24.7572941 59.2294485, 24.756415 59.228936, 24.7563567 59.2289081, 24.7560999 59.2287702, 24.755814 59.2286607, 24.7553131 59.2285304, 24.7548668 59.2284093, 24.7545533 59.2283063, 24.7542862 59.2281914, 24.7539956 59.228014, 24.7538063 59.2278984, 24.753485 59.2278093, 24.7533104 59.2278081, 24.753032 59.2278062, 24.7528015 59.227833, 24.752649 59.2278508, 24.7522155 59.2279538, 24.7518323 59.2282093, 24.7517068 59.2283654, 24.7511859 59.2290132, 24.7508995 59.2292311, 24.7505783 59.2293835, 24.7501835 59.2294647, 24.7500741 59.2294728, 24.7498351 59.2294905, 24.7491741 59.2294393, 24.7486856 59.2294014, 24.7476442 59.2294236, 24.7455272 59.2294687) โ โ way/121751399 โ tertiary โ LINESTRING (24.5332348 58.2345898, 24.5329972 58.2345964, 24.5314445 58.234741, 24.530666 58.2350134, 24.5304723 58.2350842, 24.5302861 58.2351522, 24.5299423 58.2352779, 24.5287588 58.2357619, 24.5281458 58.2360712, 24.5280274 58.2361157, 24.5279074 58.2361608, 24.5274647 58.2366135, 24.5272433 58.2369228, 24.5262897 58.2377968, 24.5257107 58.2383391, 24.5252425 58.2386842, 24.5249031 58.2388916, 24.5239738 58.2394595, 24.5231803 58.2400399, 24.5228263 58.2402068, 24.5225735 58.2404765, 24.5222114 58.2408309, 24.521956 58.2410684, 24.5218133 58.2411881, 24.5215388 58.2413328, 24.5211471 58.2414314, 24.5182863 58.2420588, 24.5172731 58.2423052, 24.5153574 58.2427802, 24.5144643 58.2430019, 24.5141068 58.2430746, 24.5138627 58.2431568) โ โ way/122056365 โ tertiary โ LINESTRING (25.8628947 58.2349211, 25.8628812 58.2348687, 25.8628755 58.2348249, 25.8628845 58.2347464, 25.8628984 58.2346248, 25.8629145 58.2344752, 25.8629159 58.2344625, 25.8629314 58.2343191, 25.8629615 58.2340394, 25.8629698 58.2339621, 25.8630074 58.2336127, 25.8630598 58.2331263, 25.8631022 58.2326505, 25.8631376 58.2322524, 25.8631604 58.2319967, 25.8631868 58.2315694, 25.8631909 58.231532) โ โ way/122091436 โ tertiary โ LINESTRING (23.8330931 58.7375182, 23.8332911 58.7374304, 23.8339133 58.7372114, 23.8350526 58.7368103, 23.8368386 58.7361987, 23.8371838 58.7360984, 23.8377268 58.7359407, 23.8386301 58.7358103, 23.8413809 58.7355006, 23.8423887 58.7353872, 23.8435805 58.7352103, 23.8459755 58.7348549, 23.8460173 58.7348484, 23.8465251 58.7347782, 23.8470809 58.7347013, 23.849573 58.7343566, 23.8500331 58.7343171, 23.850484 58.7343637, 23.8510205 58.7344543) โ โ way/122417005 โ tertiary โ LINESTRING (27.108092 58.2178393, 27.108027 58.2178834, 27.1077131 58.2180963, 27.107402 58.2183054, 27.1068495 58.2186755, 27.1063077 58.2190456, 27.1045696 58.2202548, 27.1037006 58.2209329, 27.1029174 58.2215374, 27.1019088 58.2224019, 27.1016192 58.2225319, 27.1015844 58.222542, 27.1012821 58.2226106, 27.100675 58.2227, 27.1000206 58.2227579, 27.0980465 58.2228539, 27.0964157 58.2229048, 27.0950102 58.2229217, 27.0932353 58.2228513, 27.0928752 58.222837, 27.0916092 58.2227579, 27.0899247 58.2226562, 27.0885257 58.2225676, 27.0860516 58.2224076, 27.0798718 58.2220064, 27.0790779 58.2219782, 27.0782303 58.2219838, 27.0774042 58.2220629, 27.0760309 58.2222042, 27.0757233 58.2222305, 27.0753631 58.2221999, 27.0748708 58.2220405, 27.0744597 58.2218165, 27.0741785 58.2216283, 27.0739512 58.221466) โ โ way/122419157 โ tertiary โ LINESTRING (27.0585899 58.2052012, 27.0563318 58.2049113, 27.0554739 58.2048046, 27.0547531 58.204744, 27.0523287 58.2046072, 27.0519499 58.204547, 27.0515406 58.2044072, 27.0438243 58.2015143, 27.0407859 58.2002615, 27.0381251 58.1988684, 27.0379489 58.1987406, 27.0356073 58.1970419, 27.0343657 58.1960175, 27.0323357 58.1946573, 27.0305099 58.1932244, 27.0303145 58.1930694, 27.029575 58.1925487, 27.0277546 58.1917046, 27.0269463 58.1912541, 27.026919 58.1912389, 27.0248882 58.1898434, 27.0247533 58.1897507, 27.0239482 58.1891974, 27.021946 58.1879423, 27.0217315 58.1878313, 27.0207216 58.1873088, 27.0204074 58.1870699, 27.0203787 58.187038, 27.015616 58.1817355, 27.013041 58.1793636, 27.0123057 58.1789181, 27.0117257 58.1785667, 27.0101349 58.1776256, 27.0096293 58.1773232, 27.0018962 58.1726092, 27.0014978 58.1723756, 27.0006582 58.1720519, 27.0006136 58.1720347, 26.9976989 58.1710544, 26.9950734 58.1702271, 26.9946835 58.1701042) โ โ way/122620593 โ tertiary โ LINESTRING (23.6830845 58.8147611, 23.6818878 58.8133321, 23.681484 58.812937, 23.6812066 58.8127483, 23.6807077 58.8125645, 23.6802155 58.8124744, 23.6794412 58.8123981, 23.6787843 58.8123146, 23.6781412 58.8122043, 23.6778367 58.8120919, 23.6777574 58.8119658, 23.67783 58.8115885, 23.6778486 58.8112727, 23.6778102 58.8109274, 23.6779637 58.8103734, 23.6778917 58.8101895, 23.6778102 58.8100778, 23.6775578 58.809936, 23.6754548 58.8092753, 23.6741363 58.8088262, 23.6723332 58.8082029, 23.6705473 58.8076861) โ โ way/122625453 โ tertiary โ LINESTRING (22.4821118 58.9740502, 22.4804341 58.975254, 22.479615 58.9758418, 22.4771791 58.9775917, 22.4731603 58.9804785) โ โ ยท โ ยท โ ยท โ โ ยท โ ยท โ ยท โ โ ยท โ ยท โ ยท โ โ way/1032822305 โ tertiary โ LINESTRING (26.9761623 58.3739097, 26.9767983 58.3740608, 26.976877 58.3740788, 26.9774819 58.3742626, 26.9783419 58.3745239, 26.9795165 58.3748808, 26.9811342 58.3754215, 26.9821998 58.3757777, 26.9827682 58.3759769, 26.9838767 58.3763653, 26.9840041 58.37641, 26.9856268 58.3769516, 26.9858611 58.3770211, 26.9872747 58.3774402, 26.9881212 58.3776147, 26.9889371 58.3777829, 26.9899725 58.3779287, 26.9904271 58.3779494, 26.9925988 58.3780334) โ โ way/1032822306 โ tertiary โ LINESTRING (26.9119191 58.3543161, 26.9122278 58.3544324, 26.9158644 58.3558025, 26.9163204 58.3559868, 26.9188749 58.3569973, 26.9258 58.3598166, 26.9261719 58.3599685, 26.9297447 58.361428, 26.9302933 58.3616558, 26.9344368 58.3633761, 26.9346446 58.3634624, 26.9399091 58.3658904, 26.9414549 58.3665685, 26.9415301 58.3665955, 26.94225 58.3668543, 26.9423761 58.3668996, 26.9431423 58.3671549, 26.9433632 58.3672285, 26.943632 58.3673147, 26.945035 58.3677643, 26.9461871 58.3680925, 26.9494245 58.3689237, 26.9520911 58.3696115, 26.9553889 58.3704622, 26.9580285 58.3710455, 26.9591222 58.3712788, 26.9599261 58.3713775, 26.9635481 58.3718767, 26.9642948 58.3719701, 26.9658947 58.3721701, 26.966873 58.3722924, 26.9703328 58.372743, 26.9723105 58.3730564, 26.9733406 58.3732621, 26.9746553 58.3735671, 26.9756666 58.3738017, 26.9761623 58.3739097) โ โ way/1032822307 โ tertiary โ LINESTRING (27.044551 58.3834483, 27.0440711 58.3849766, 27.0438758 58.3859081) โ โ way/1032822308 โ tertiary โ LINESTRING (27.0442642 58.3834603, 27.0436083 58.3834876) โ โ way/1032822309 โ tertiary โ LINESTRING (27.0436083 58.3834876, 27.0352269 58.383837, 27.0335431 58.3839072, 27.0270336 58.3841786, 27.0259303 58.3842246, 27.0249303 58.3842718, 27.0233476 58.3841321, 27.0198601 58.3838242, 27.0174561 58.3836119, 27.0136068 58.3832721, 27.0097212 58.382929, 27.0095132 58.3829229, 27.0091445 58.3829086) โ โ way/1032822573 โ tertiary โ LINESTRING (26.759768 58.1073551, 26.7570336 58.106947, 26.7566435 58.1068969, 26.7564041 58.1069006, 26.7561333 58.1069655, 26.7554199 58.1073076, 26.7550837 58.1074143, 26.7546264 58.107502, 26.7541868 58.1075502, 26.753407 58.1075444, 26.7527185 58.1075649, 26.7521952 58.1076101, 26.7510202 58.1077965, 26.7503886 58.1078921, 26.7497803 58.1079675, 26.7492634 58.1080473, 26.7489221 58.1081173, 26.7463635 58.1088312, 26.7447958 58.1092282, 26.7443246 58.1093678, 26.7440513 58.1094781, 26.7438404 58.109595, 26.7436187 58.1097441, 26.7431634 58.1101295, 26.7430032 58.1102382, 26.7427716 58.1103413, 26.7419426 58.1105393, 26.7410417 58.110733, 26.7401366 58.1108827, 26.7393489 58.1109581, 26.7384566 58.1110074, 26.7380389 58.1110274, 26.7368286 58.1110853) โ โ way/1032822574 โ tertiary โ LINESTRING (26.7683463 58.1051722, 26.7651561 58.1064285, 26.764917 58.1065218, 26.7640942 58.1067852, 26.7636802 58.1068779, 26.7614346 58.1072126, 26.7603609 58.1073523, 26.7600564 58.1073712, 26.759768 58.1073551) โ โ way/1032825182 โ tertiary โ LINESTRING (27.0729247 58.4899558, 27.0729701 58.4902786, 27.0728323 58.4914024, 27.0719735 58.4932471, 27.0719744 58.493452, 27.071975 58.4936083) โ โ way/1032825183 โ tertiary โ LINESTRING (27.071975 58.4936083, 27.0720477 58.4963959, 27.072122 58.496926, 27.0727793 58.4987495, 27.0727878 58.4987764, 27.0728615 58.4990083, 27.0734992 58.501015, 27.0736376 58.5015812) โ โ way/1032828401 โ tertiary โ LINESTRING (27.2640185 58.2687502, 27.2637622 58.2686021, 27.2633177 58.2683452, 27.2619276 58.2674805, 27.2609724 58.2668864, 27.2592695 58.2658922, 27.258778 58.2656498, 27.2585096 58.2655174, 27.2576521 58.2651374, 27.2566044 58.2647812, 27.2562472 58.2646989) โ โโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ ? rows (>9999 rows, 20 shown) 3 columns โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Count loaded roadsยถ
features_relation.count("feature_id")
โโโโโโโโโโโโโโโโโโโโโ โ count(feature_id) โ โ int64 โ โโโโโโโโโโโโโโโโโโโโโค โ 25601 โ โโโโโโโโโโโโโโโโโโโโโ
length_in_meters = (
features_relation.project(
"ST_Length(ST_Transform(geometry, 'EPSG:4326', 'EPSG:3301')) AS road_length"
)
.sum("road_length")
.fetchone()[0]
)
length_in_km = length_in_meters / 1000
length_in_km
29497.27406457454
Plot the roads using GeoPandasยถ
With fast loading of geoparquet files using geoarrow.pyarrow
library.
import geoarrow.pyarrow as ga
from geoarrow.pyarrow import io
from quackosm._constants import GEOMETRY_COLUMN
parquet_table = io.read_geoparquet_table(estonia_features_gpq)
ga.to_geopandas(parquet_table.column(GEOMETRY_COLUMN)).plot()
<Axes: >
Download all data for Liechtensteinยถ
Without filtering, with tags in a compact form
liechtenstein_pbf_url = "https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf"
liechtenstein_pbf_file = "liechtenstein.osm.pbf"
urllib.request.urlretrieve(liechtenstein_pbf_url, liechtenstein_pbf_file)
# Here explode_tags is set to False explicitly,
# but it would set automatically when not filtering the data
reader = PbfFileReader(geometry_filter=None, tags_filter=None)
liechtenstein_features_gpq = reader.convert_pbf_to_parquet(
liechtenstein_pbf_file, explode_tags=False
)
liechtenstein_features_gpq
PosixPath('files/liechtenstein_nofilter_noclip_compact.parquet')
features_relation = connection.read_parquet(str(liechtenstein_features_gpq))
features_relation
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ feature_id โ tags โ geometry โ โ varchar โ map(varchar, varchar) โ geometry โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ node/26863444 โ {name=Kuhgrat, natural=peak, wikidata=Q4244296, wikimedia_commons=Category:Kuegrat, wikipedia=en:Kuhgrat} โ POINT (9.5608307 47.1666716) โ โ node/30603864 โ {crossing=uncontrolled, highway=crossing} โ POINT (9.5203855 47.1705163) โ โ node/32011241 โ {name=Oberplanken, place=hamlet} โ POINT (9.5450182 47.178495) โ โ node/32011242 โ {loc_name=Planka, loc_name:de=Planka, name=Planken, name:de=Planken, name:mk=ะะปะฐะฝะบะตะฝ, name:ru=ะะปะฐะฝะบะตะฝ, name:uk=ะะปะฐะฝะบะตะฝ, name:zh=ๆฎๅ ฐ่ฏ, opengeodb:lat=47.1858848, opengeodb:lon=9.5452211, place=village, population=445, postal_code=9498, website=https://www.planken.li/, wikidata=Q49660, wikipedia=de:Planken} โ POINT (9.5452211 47.1858848) โ โ node/32011279 โ {bus=yes, name=Schaanwald Zuschg, public_transport=stop_position} โ POINT (9.5622276 47.2113777) โ โ node/32011334 โ {crossing=uncontrolled, crossing:island=yes, highway=crossing} โ POINT (9.5187913 47.1719187) โ โ node/32011343 โ {crossing=uncontrolled, crossing:island=no, crossing_ref=zebra, highway=crossing} โ POINT (9.5087978 47.1647872) โ โ node/32011354 โ {crossing=uncontrolled, crossing:island=yes, highway=crossing, tactile_paving=no} โ POINT (9.5119617 47.1496875) โ โ node/32011360 โ {bus=yes, name=Vaduz Quรคderle, public_transport=stop_position} โ POINT (9.5183012 47.1432488) โ โ node/32020981 โ {bus=yes, name=Eschen Presta, public_transport=stop_position} โ POINT (9.5284713 47.2074785) โ โ ยท โ ยท โ ยท โ โ ยท โ ยท โ ยท โ โ ยท โ ยท โ ยท โ โ way/284115729 โ {addr:city=Triesen, addr:country=LI, addr:housenumber=14, addr:postcode=9495, addr:street=Maschlinastrasse, building=apartments} โ POLYGON ((9.5257087 47.116193, 9.525701 47.11623, 9.5255504 47.1162157, 9.5255345 47.1162933, 9.5257857 47.1163172, 9.5258017 47.1162396, 9.5257965 47.1162391, 9.5258042 47.1162021, 9.5257087 47.116193)) โ โ way/328337684 โ {highway=path, tracktype=grade4} โ LINESTRING (9.5309695 47.1677601, 9.5312457 47.1677719, 9.5314399 47.1677555) โ โ way/408720754 โ {building=yes} โ POLYGON ((9.5082537 47.1450903, 9.5082649 47.1450668, 9.5082066 47.145054, 9.5081954 47.1450775, 9.5082537 47.1450903)) โ โ way/980924838 โ {building=yes} โ POLYGON ((9.53015 47.2145529, 9.5301362 47.2145351, 9.5301904 47.2145157, 9.5302042 47.2145336, 9.53015 47.2145529)) โ โ way/43341018 โ {cycleway:both=no, highway=residential, lit=yes, maxspeed=50, name=Tristelstrasse, surface=asphalt} โ LINESTRING (9.5439434 47.1203265, 9.5435746 47.1202864, 9.5433774 47.1203119, 9.5431956 47.1203594, 9.5429536 47.1204579, 9.5428477 47.1205154, 9.5427471 47.1205829, 9.5424159 47.120823, 9.5423131 47.1209343, 9.5422686 47.1210252, 9.54223 47.1211008, 9.5421986 47.1211624, 9.5421208 47.1212911, 9.5420591 47.1213568, 9.5419465 47.1214088, 9.5418177 47.1214544, 9.5416648 47.1215174) โ โ way/467032160 โ {landuse=grass} โ POLYGON ((9.5455113 47.2017008, 9.5455838 47.2018746, 9.5456547 47.2020257, 9.5460356 47.2019492, 9.5461053 47.202033, 9.5461912 47.2022226, 9.5462366 47.2024085, 9.5468649 47.2023763, 9.5483099 47.2022075, 9.5488763 47.2021917, 9.5492636 47.2021603, 9.5492186 47.2020387, 9.5493189 47.2019954, 9.549333 47.201909, 9.5494452 47.2017743, 9.5495179 47.2016106, 9.5493947 47.201515, 9.5491553 47.2014958, 9.5488548 47.201535, 9.5487161 47.2016371, 9.5484849 47.2011737, 9.5489819 47.2010952, 9.5486236 47.200781, 9.548604 47.2004357, 9.5483559 47.2001361, 9.5475955 47.2003155, 9.5474507 47.200239, 9.5472854 47.2001887, 9.5472249 47.2002387, 9.5460729 47.2001414, 9.5462646 47.2003626, 9.5462555 47.200473, 9.5465119 47.2008112, 9.5462544 47.2009023, 9.5461411 47.2007282, 9.545616 47.2008841, 9.5452163 47.2009694, 9.5452791 47.2011361, 9.5453811 47.2013512, 9.5458531 47.201271, 9.5459872 47.2016245, 9.5455113 47.2017008)) โ โ way/297358616 โ {highway=path} โ LINESTRING (9.5314893 47.1019879, 9.5316497 47.10196, 9.5318021 47.1019651, 9.531981 47.1019523, 9.5321293 47.1019286, 9.5322925 47.1019101, 9.5324383 47.1018718, 9.5326546 47.1018204, 9.5329196 47.1018301, 9.5331822 47.1018521, 9.5333722 47.1018772, 9.5335646 47.1019538) โ โ way/346556176 โ {addr:city=Triesen, addr:country=LI, addr:housenumber=10, addr:postcode=9495, addr:street=Weiherstrasse, building=yes} โ POLYGON ((9.5330071 47.1130913, 9.5330471 47.1129556, 9.5329149 47.1129376, 9.5328807 47.1130536, 9.532916 47.1130584, 9.5329102 47.1130781, 9.5330071 47.1130913)) โ โ way/1056833088 โ {building=yes} โ POLYGON ((9.4987575 47.0651143, 9.4987944 47.0650658, 9.4986707 47.0650222, 9.4986338 47.0650707, 9.4987575 47.0651143)) โ โ way/979816844 โ {addr:city=Eschen, addr:country=LI, addr:housenumber=31, addr:postcode=9492, addr:street=Sagenstrasse, building=yes} โ POLYGON ((9.5137626 47.2109118, 9.513672 47.2109144, 9.5136645 47.2107937, 9.5137554 47.2107911, 9.5137569 47.2108166, 9.5137707 47.2108162, 9.5137747 47.2108804, 9.5137607 47.2108808, 9.5137626 47.2109118)) โ โโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ ? rows (>9999 rows, 20 shown) 3 columns โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Return data as GeoDataFrameยถ
PbfFileReader
can also return the data in the GeoDataFrame form.
Here the caching strategy will be utilized - file won't be transformed again.
features_gdf = reader.convert_pbf_to_geodataframe(liechtenstein_pbf_file)
features_gdf
tags | geometry | |
---|---|---|
feature_id | ||
node/26863444 | {'name': 'Kuhgrat', 'natural': 'peak', 'wikida... | POINT (9.56083 47.16667) |
node/30603864 | {'crossing': 'uncontrolled', 'highway': 'cross... | POINT (9.52039 47.17052) |
node/32011241 | {'name': 'Oberplanken', 'place': 'hamlet'} | POINT (9.54502 47.1785) |
node/32011242 | {'loc_name': 'Planka', 'loc_name:de': 'Planka'... | POINT (9.54522 47.18588) |
node/32011279 | {'bus': 'yes', 'name': 'Schaanwald Zuschg', 'p... | POINT (9.56223 47.21138) |
... | ... | ... |
relation/7182745 | {'landuse': 'residential', 'type': 'multipolyg... | POLYGON ((9.52731 47.11932, 9.52722 47.11939, ... |
relation/7111273 | {'landuse': 'residential', 'type': 'multipolyg... | POLYGON ((9.49936 47.16394, 9.49929 47.16412, ... |
relation/16160185 | {'landuse': 'meadow', 'type': 'multipolygon'} | POLYGON ((9.57481 47.17175, 9.5744 47.17193, 9... |
relation/7079161 | {'landuse': 'residential', 'type': 'multipolyg... | POLYGON ((9.51731 47.17089, 9.51731 47.171, 9.... |
relation/16354156 | {'landuse': 'grass', 'type': 'multipolygon'} | POLYGON ((9.55162 47.23007, 9.55201 47.23013, ... |
51737 rows ร 2 columns
Plot the forests using GeoPandasยถ
Filter all polygons and features with landuse
=forest
.