OSM PBF Loader¶
OSMPbfLoader
can really quickly parse full OSM extract in the form of *.osm.pbf
file.
It can download and parse a lot of features much faster than the OSMOnlineLoader
, but it's much more useful when a lot of different features are required at once (like when using predefined filters).
When only a single or few features are needed, OSMOnlineLoader
might be a better choice, since OSMPbfLoader
will use a full extract of all features in a given region and will have to iterate over all of them.
import geopandas as gpd
from shapely.geometry import Point, box
from srai.constants import REGIONS_INDEX, WGS84_CRS
from srai.geometry import buffer_geometry
from srai.loaders.osm_loaders import OSMPbfLoader
from srai.loaders.osm_loaders.filters import GEOFABRIK_LAYERS, HEX2VEC_FILTER
from srai.loaders.osm_loaders.filters.popular import get_popular_tags
from srai.regionalizers import geocode_to_region_gdf
Using OSMPbfLoader to download data for a specific area¶
Download all features from HEX2VEC_FILTER
in Warsaw, Poland¶
loader = OSMPbfLoader()
warsaw_gdf = geocode_to_region_gdf("Warsaw, Poland")
warsaw_features_gdf = loader.load(warsaw_gdf, HEX2VEC_FILTER)
warsaw_features_gdf
Finished operation in 0:00:52
geometry | aeroway | amenity | building | healthcare | historic | landuse | leisure | military | natural | office | shop | sport | tourism | water | waterway | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
feature_id | ||||||||||||||||
node/1692272403 | POINT (21.08287 52.26558) | None | None | None | None | None | None | None | None | None | None | None | None | museum | None | None |
node/1692272423 | POINT (21.08241 52.2657) | None | charging_station | None | None | None | None | None | None | None | None | None | None | None | None | None |
node/1692396880 | POINT (21.04772 52.2375) | None | bicycle_parking | None | None | None | None | None | None | None | None | None | None | None | None | None |
node/1692401647 | POINT (21.02456 52.2335) | None | None | None | None | None | None | None | None | None | None | bicycle | None | None | None | None |
node/1692404943 | POINT (21.02492 52.2329) | None | bicycle_parking | None | None | None | None | None | None | None | None | None | None | None | None | None |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
way/961142300 | POLYGON ((21.11355 52.25622, 21.11354 52.25622... | None | None | retail | None | None | None | None | None | None | None | None | None | None | None | None |
way/961142301 | POLYGON ((21.1132 52.25792, 21.11322 52.25838,... | None | None | yes | None | None | None | None | None | None | None | None | None | None | None | None |
way/961142302 | POLYGON ((21.11967 52.25702, 21.11966 52.25706... | None | None | detached | None | None | None | None | None | None | None | None | None | None | None | None |
way/961142303 | POLYGON ((21.11848 52.25688, 21.11848 52.2569,... | None | None | detached | None | None | None | None | None | None | None | None | None | None | None | None |
way/961142304 | POLYGON ((21.11889 52.25544, 21.1189 52.25545,... | None | None | detached | None | None | None | None | None | None | None | None | None | None | None | None |
326380 rows × 16 columns
Plot features¶
Inspired by prettymaps
clipped_features_gdf = warsaw_features_gdf.clip(warsaw_gdf.geometry.unary_union)
/tmp/ipykernel_4390/1645165564.py:1: DeprecationWarning: The 'unary_union' attribute is deprecated, use the 'union_all()' method instead. clipped_features_gdf = warsaw_features_gdf.clip(warsaw_gdf.geometry.unary_union)
ax = warsaw_gdf.plot(color="lavender", figsize=(16, 16))
# plot water
clipped_features_gdf.dropna(subset=["water", "waterway"], how="all").plot(
ax=ax, color="deepskyblue"
)
# plot greenery
clipped_features_gdf[
clipped_features_gdf["landuse"].isin(
["grass", "orchard", "flowerbed", "forest", "greenfield", "meadow"]
)
].plot(ax=ax, color="mediumseagreen")
# plot buildings
clipped_features_gdf.dropna(subset=["building"], how="all").plot(
ax=ax, color="dimgray", markersize=0.1
)
xmin, ymin, xmax, ymax = warsaw_gdf.total_bounds
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
ax.set_axis_off()
Download all features from popular tags based on OSMTagInfo in Vienna, Austria¶
popular_tags = get_popular_tags(in_wiki_only=True)
num_keys = len(popular_tags)
f"Unique keys: {num_keys}."
'Unique keys: 354.'
{k: popular_tags[k] for k in list(popular_tags)[:10]}
{'4wd_only': ['yes'], 'LandPro08:reviewed': ['no'], 'abandoned': ['yes'], 'abandoned:railway': ['rail'], 'abutters': ['residential'], 'access': ['agricultural', 'customers', 'delivery', 'designated', 'destination', 'forestry', 'no', 'permissive', 'permit', 'private', 'unknown', 'yes'], 'addr:TW:dataset': ['137998'], 'addr:country': ['CZ', 'DE', 'RU', 'US'], 'addr:state': ['AZ', 'CA', 'CO', 'CT', 'FL', 'IN', 'KY', 'MD', 'ME', 'NC', 'NJ', 'NY', 'PA', 'TX'], 'admin_level': ['10', '11', '2', '4', '5', '6', '7', '8', '9']}
vienna_center_circle = buffer_geometry(Point(16.37009, 48.20931), meters=1000)
vienna_center_circle_gdf = gpd.GeoDataFrame(
geometry=[vienna_center_circle],
crs=WGS84_CRS,
index=gpd.pd.Index(data=["Vienna"], name=REGIONS_INDEX),
)
loader = OSMPbfLoader()
vienna_features_gdf = loader.load(vienna_center_circle_gdf, popular_tags)
vienna_features_gdf
/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/quackosm/pb f_file_reader.py:2614: UserWarning: Select clause contains more than 100 columns (found 354 columns). Query might fail with insufficient memory resources. Consider applying more restrictive OsmTagsFilter for parsing. warnings.warn(
Finished operation in 0:00:29
geometry | abandoned | access | admin_level | advertising | amenity | area:highway | artwork_type | atm | barrier | ... | tunnel | type | usage | vehicle | vending | waste | water | water_source | waterway | wheelchair | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
feature_id | |||||||||||||||||||||
node/33182886 | POINT (16.36631 48.20782) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
node/33182965 | POINT (16.37033 48.20359) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
node/33344361 | POINT (16.36484 48.2159) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
node/33344362 | POINT (16.36413 48.21558) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
node/34591548 | POINT (16.36967 48.20235) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
relation/8075616 | POLYGON ((16.36914 48.20459, 16.36915 48.20459... | None | None | None | None | None | None | None | None | None | ... | None | multipolygon | None | None | None | None | None | None | None | None |
relation/8075617 | POLYGON ((16.36821 48.20446, 16.36824 48.20447... | None | None | None | None | None | None | None | None | None | ... | None | multipolygon | None | None | None | None | None | None | None | None |
relation/8075646 | POLYGON ((16.36712 48.20596, 16.36709 48.20594... | None | None | None | None | None | None | None | None | None | ... | None | multipolygon | None | None | None | None | None | None | None | None |
relation/11951565 | POLYGON ((16.36197 48.21226, 16.36197 48.21226... | None | None | None | None | None | None | None | None | None | ... | None | multipolygon | None | None | None | None | None | None | None | None |
relation/8075633 | POLYGON ((16.36871 48.20327, 16.36857 48.203, ... | None | None | None | None | None | None | None | None | None | ... | None | multipolygon | None | None | None | None | None | None | None | None |
22667 rows × 189 columns
Plot features¶
Uses default
preset colours from prettymaps
clipped_vienna_features_gdf = vienna_features_gdf.clip(vienna_center_circle)
ax = vienna_center_circle_gdf.plot(color="#F2F4CB", figsize=(16, 16))
# plot water
clipped_vienna_features_gdf.dropna(subset=["water", "waterway"], how="all").plot(
ax=ax, color="#a8e1e6"
)
# plot streets
clipped_vienna_features_gdf.dropna(subset=["highway"], how="all").plot(
ax=ax, color="#475657", markersize=0.1
)
# plot buildings
clipped_vienna_features_gdf.dropna(subset=["building"], how="all").plot(ax=ax, color="#FF5E5B")
# plot parkings
clipped_vienna_features_gdf[
(clipped_vienna_features_gdf["amenity"] == "parking")
| (clipped_vienna_features_gdf["highway"] == "pedestrian")
].plot(ax=ax, color="#2F3737", markersize=0.1)
# plot greenery
clipped_vienna_features_gdf[
clipped_vienna_features_gdf["landuse"].isin(
["grass", "orchard", "flowerbed", "forest", "greenfield", "meadow"]
)
].plot(ax=ax, color="#8BB174")
xmin, ymin, xmax, ymax = vienna_center_circle_gdf.total_bounds
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
ax.set_axis_off()
Download all grouped features based on Geofabrik layers in New York, USA¶
manhattan_bbox = box(-73.994551, 40.762396, -73.936872, 40.804239)
manhattan_bbox_gdf = gpd.GeoDataFrame(
geometry=[manhattan_bbox],
crs=WGS84_CRS,
index=gpd.pd.Index(data=["New York"], name=REGIONS_INDEX),
)
loader = OSMPbfLoader()
new_york_features_gdf = loader.load(manhattan_bbox_gdf, GEOFABRIK_LAYERS)
new_york_features_gdf
/opt/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/quackosm/osm_extracts/__init__.py:602: GeometryNotCoveredWarning: Skipping extract because of low IoU value (bbbike_newyork, 0.000187). warnings.warn(
Finished operation in 0:00:34
geometry | accommodation | buildings | catering | education | fuel_parking | health | highway_links | landuse | leisure | ... | public | railways | shopping | tourism | traffic | transport | very_small_roads | water | water_traffic | waterways | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
feature_id | |||||||||||||||||||||
node/2494098726 | POINT (-73.98357 40.77559) | None | None | None | None | None | None | None | None | None | ... | amenity=post_office | None | None | None | None | None | None | None | None | None |
node/2494098730 | POINT (-73.98352 40.77565) | None | None | None | None | None | None | None | None | None | ... | None | None | shop=beauty | None | None | None | None | None | None | None |
node/2723866660 | POINT (-73.96713 40.76986) | None | None | amenity=cafe | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
node/2723866677 | POINT (-73.96559 40.76912) | None | None | None | None | None | None | None | None | None | ... | office=diplomatic | None | None | None | None | None | None | None | None | None |
node/2723866723 | POINT (-73.96369 40.76865) | None | None | None | None | None | None | None | None | None | ... | None | None | shop=florist | None | None | None | None | None | None | None |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
relation/5265382 | POLYGON ((-73.95045 40.78489, -73.95012 40.785... | None | building=yes | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
relation/5389891 | POLYGON ((-73.98383 40.77276, -73.9839 40.7727... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
relation/5917031 | POLYGON ((-73.97819 40.76298, -73.97856 40.762... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
relation/6779497 | POLYGON ((-73.98378 40.7671, -73.98385 40.767,... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
relation/4623434 | POLYGON ((-73.98243 40.77731, -73.98245 40.777... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
49317 rows × 27 columns
Plot features¶
Inspired by https://snazzymaps.com/style/14889/flat-pale
ax = manhattan_bbox_gdf.plot(color="#e7e7df", figsize=(16, 16))
# plot greenery
new_york_features_gdf[new_york_features_gdf["leisure"] == "leisure=park"].plot(
ax=ax, color="#bae5ce"
)
# plot water
new_york_features_gdf.dropna(subset=["water", "waterways"], how="all").plot(ax=ax, color="#c7eced")
# plot streets
new_york_features_gdf.dropna(subset=["paths_unsuitable_for_cars"], how="all").plot(
ax=ax, color="#e7e7df", linewidth=1
)
new_york_features_gdf.dropna(
subset=["very_small_roads", "highway_links", "minor_roads"], how="all"
).plot(ax=ax, color="#fff", linewidth=2)
new_york_features_gdf.dropna(subset=["major_roads"], how="all").plot(
ax=ax, color="#fac9a9", linewidth=3
)
# plot buildings
new_york_features_gdf.dropna(subset=["buildings"], how="all").plot(ax=ax, color="#cecebd")
xmin, ymin, xmax, ymax = manhattan_bbox_gdf.total_bounds
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
ax.set_axis_off()
Using OSMPbfLoader to download data for a specific area and transforming it to GeoParquet file¶
Download all grouped features based on Geofabrik layers in Reykjavík, Iceland¶
loader = OSMPbfLoader()
reykjavik_gdf = geocode_to_region_gdf("Reykjavík, IS")
reykjavik_features_gpq = loader.load_to_geoparquet(reykjavik_gdf, GEOFABRIK_LAYERS)
reykjavik_features_gpq
Finished operation in 0:00:23
PosixPath('files/3b68f6ecc515eba6f588efa104d7eee92b450cf9c7e54f445afae421e604cf3f_098931824b94bfe02e01bc4987422a39ec47bd3f6924e5325ddae0846badafba_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_features_gpq))
features_relation
┌─────────────────┬───────────────┬─────────────┬───────────┬──────────┬───────────┬──────────────┬─────────┬───────────────┬─────────┬─────────┬─────────────┬─────────────┬───────────────┬─────────┬─────────┬───────────────────────────┬─────────┬─────────┬──────────┬──────────┬────────────────────┬───────────────────────────┬───────────┬──────────────────┬─────────┬───────────────┬───────────┬────────────────────────────────┐ │ feature_id │ accommodation │ air_traffic │ buildings │ catering │ education │ fuel_parking │ health │ highway_links │ landuse │ leisure │ major_roads │ minor_roads │ miscpoi │ money │ natural │ paths_unsuitable_for_cars │ pofw │ public │ railways │ shopping │ tourism │ traffic │ transport │ very_small_roads │ water │ water_traffic │ waterways │ geometry │ │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ varchar │ geometry │ ├─────────────────┼───────────────┼─────────────┼───────────┼──────────┼───────────┼──────────────┼─────────┼───────────────┼─────────┼─────────┼─────────────┼─────────────┼───────────────┼─────────┼─────────┼───────────────────────────┼─────────┼─────────┼──────────┼──────────┼────────────────────┼───────────────────────────┼───────────┼──────────────────┼─────────┼───────────────┼───────────┼────────────────────────────────┤ │ node/580916853 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ tourism=attraction │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9345086 64.1374733) │ │ node/582112543 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=motorway_junction │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.896997 64.1328301) │ │ node/582112601 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=motorway_junction │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8950065 64.1325403) │ │ node/1221993805 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=crossing │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9163661 64.1431158) │ │ node/1221993833 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=traffic_signals │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9222174 64.1377959) │ │ node/1221993868 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=traffic_signals │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9202618 64.1395186) │ │ node/1229213284 │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=fuel │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9662321 64.1435561) │ │ node/1229320411 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=traffic_signals │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8631485 64.126886) │ │ node/1229320424 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=traffic_signals │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.863451 64.12618) │ │ node/1229340591 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=traffic_signals │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8729315 64.1332079) │ │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ │ node/2018349582 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.7827723 64.097729) │ │ node/2018349588 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.844457 64.0982388) │ │ node/2018349591 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.7713334 64.0982995) │ │ node/2018349594 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8087048 64.0983843) │ │ node/2018349598 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8178784 64.0987291) │ │ node/2018349601 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8205695 64.0987297) │ │ node/2018349605 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8231854 64.0987393) │ │ node/2018349608 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8232813 64.0987432) │ │ node/2018349611 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8152231 64.098907) │ │ node/2018349614 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=bench │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.7852045 64.0990287) │ ├─────────────────┴───────────────┴─────────────┴───────────┴──────────┴───────────┴──────────────┴─────────┴───────────────┴─────────┴─────────┴─────────────┴─────────────┴───────────────┴─────────┴─────────┴───────────────────────────┴─────────┴─────────┴──────────┴──────────┴────────────────────┴───────────────────────────┴───────────┴──────────────────┴─────────┴───────────────┴───────────┴────────────────────────────────┤ │ ? rows (>9999 rows, 20 shown) 29 columns │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Count all buildings¶
features_relation.filter("buildings IS NOT NULL").count("feature_id")
┌───────────────────┐ │ count(feature_id) │ │ int64 │ ├───────────────────┤ │ 25359 │ └───────────────────┘
You can see more examples of how to use PbfFileReader
from the QuackOSM
library in the docs: https://kraina-ai.github.io/quackosm/latest/examples/pbf_file_reader/