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.
In [1]:
Copied!
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
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¶
In [2]:
Copied!
loader = OSMPbfLoader()
warsaw_gdf = geocode_to_region_gdf("Warsaw, Poland")
warsaw_features_gdf = loader.load(warsaw_gdf, HEX2VEC_FILTER)
warsaw_features_gdf
loader = OSMPbfLoader()
warsaw_gdf = geocode_to_region_gdf("Warsaw, Poland")
warsaw_features_gdf = loader.load(warsaw_gdf, HEX2VEC_FILTER)
warsaw_features_gdf
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/pyogrio/geopandas.py:662: UserWarning: 'crs' was not provided. The output dataset will not have projection information defined and may not be usable in other systems. write(
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/geopandas/array.py:1638: UserWarning: CRS not set for some of the concatenation inputs. Setting output's CRS as WGS 84 (the single non-null crs provided). return GeometryArray(data, crs=_get_common_crs(to_concat))
Finished operation in 0:00:53
Out[2]:
geometry | aeroway | amenity | building | healthcare | historic | landuse | leisure | military | natural | office | shop | sport | tourism | water | waterway | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
feature_id | ||||||||||||||||
node/1842824313 | POINT (20.93532 52.28486) | None | post_office | None | None | None | None | None | None | None | None | None | None | None | None | None |
node/1843248304 | POINT (21.01587 52.23087) | None | bicycle_parking | None | None | None | None | None | None | None | None | None | None | None | None | None |
node/1843254633 | POINT (21.03134 52.23971) | None | bicycle_parking | None | None | None | None | None | None | None | None | None | None | None | None | None |
node/1846013889 | POINT (21.08482 52.2216) | None | nightclub | None | None | None | None | None | None | None | None | None | None | None | None | None |
node/1846013914 | POINT (21.01242 52.2206) | None | None | None | None | None | None | None | None | None | None | tailor | None | None | None | None |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
way/967888042 | POLYGON ((21.02142 52.19196, 21.02151 52.19197... | None | None | semidetached_house | None | None | None | None | None | None | None | None | None | None | None | None |
way/967888043 | POLYGON ((21.02407 52.19257, 21.02409 52.19228... | None | None | apartments | None | yes | None | None | None | None | None | None | None | None | None | None |
way/967888044 | POLYGON ((21.02093 52.19337, 21.02095 52.19331... | None | None | apartments | None | None | None | None | None | None | None | None | None | None | None | None |
way/967888045 | POLYGON ((21.02307 52.19205, 21.02307 52.19205... | None | None | detached | None | yes | None | None | None | None | None | None | None | None | None | None |
way/967888046 | POLYGON ((21.02144 52.19173, 21.02148 52.19164... | None | None | house | None | None | None | None | None | None | None | None | None | None | None | None |
332239 rows × 16 columns
Plot features¶
Inspired by prettymaps
In [3]:
Copied!
clipped_features_gdf = warsaw_features_gdf.clip(warsaw_gdf.geometry.union_all())
clipped_features_gdf = warsaw_features_gdf.clip(warsaw_gdf.geometry.union_all())
In [4]:
Copied!
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()
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¶
In [5]:
Copied!
popular_tags = get_popular_tags(in_wiki_only=True)
num_keys = len(popular_tags)
f"Unique keys: {num_keys}."
popular_tags = get_popular_tags(in_wiki_only=True)
num_keys = len(popular_tags)
f"Unique keys: {num_keys}."
Out[5]:
'Unique keys: 360.'
In [6]:
Copied!
{k: popular_tags[k] for k in list(popular_tags)[:10]}
{k: popular_tags[k] for k in list(popular_tags)[:10]}
Out[6]:
{'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']}
In [7]:
Copied!
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),
)
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),
)
In [8]:
Copied!
loader = OSMPbfLoader()
vienna_features_gdf = loader.load(vienna_center_circle_gdf, popular_tags)
vienna_features_gdf
loader = OSMPbfLoader()
vienna_features_gdf = loader.load(vienna_center_circle_gdf, popular_tags)
vienna_features_gdf
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/geopandas/array.py:1638: UserWarning: CRS not set for some of the concatenation inputs. Setting output's CRS as WGS 84 (the single non-null crs provided). return GeometryArray(data, crs=_get_common_crs(to_concat))
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/quackosm/pb f_file_reader.py:2614: UserWarning: Select clause contains more than 100 columns (found 360 columns). Query might fail with insufficient memory resources. Consider applying more restrictive OsmTagsFilter for parsing. warnings.warn(
Finished operation in 0:00:30
Out[8]:
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 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
way/994956644 | POLYGON ((16.37064 48.21644, 16.37075 48.21649... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/996302612 | LINESTRING (16.37587 48.21453, 16.3758 48.21462) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/997555943 | LINESTRING (16.36499 48.21306, 16.36499 48.21292) | None | None | None | None | None | None | None | None | None | ... | building_passage | None | None | None | None | None | None | None | None | None |
way/997555944 | LINESTRING (16.36499 48.2131, 16.36499 48.21306) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/1000492276 | LINESTRING (16.36618 48.20044, 16.36623 48.200... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
22730 rows × 191 columns
Plot features¶
Uses default
preset colours from prettymaps
In [9]:
Copied!
clipped_vienna_features_gdf = vienna_features_gdf.clip(vienna_center_circle)
clipped_vienna_features_gdf = vienna_features_gdf.clip(vienna_center_circle)
In [10]:
Copied!
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()
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¶
In [11]:
Copied!
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),
)
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),
)
In [12]:
Copied!
loader = OSMPbfLoader()
new_york_features_gdf = loader.load(manhattan_bbox_gdf, GEOFABRIK_LAYERS)
new_york_features_gdf
loader = OSMPbfLoader()
new_york_features_gdf = loader.load(manhattan_bbox_gdf, GEOFABRIK_LAYERS)
new_york_features_gdf
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/geopandas/array.py:1638: UserWarning: CRS not set for some of the concatenation inputs. Setting output's CRS as WGS 84 (the single non-null crs provided). return GeometryArray(data, crs=_get_common_crs(to_concat)) /opt/hostedtoolcache/Python/3.10.16/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
Out[12]:
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/462004948 | POINT (-73.95553 40.77949) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | railway=station | None | None | None | None |
node/480491548 | POINT (-73.96358 40.78135) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | highway=crossing | None | None | None | None | None |
node/480492539 | POINT (-73.96863 40.77474) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | highway=crossing | None | None | None | None | None |
node/480492646 | POINT (-73.96828 40.77501) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | highway=crossing | None | None | None | None | None |
node/480492947 | POINT (-73.9665 40.7781) | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | highway=crossing | None | None | None | None | None |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
way/1151920424 | LINESTRING (-73.96395 40.8029, -73.9639 40.802... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/1151920425 | LINESTRING (-73.96383 40.80284, -73.96379 40.8... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/1151920426 | LINESTRING (-73.96287 40.80417, -73.96284 40.8... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/1153095181 | LINESTRING (-73.96958 40.7629, -73.96956 40.76... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
way/1153095182 | LINESTRING (-73.96964 40.76279, -73.96965 40.7... | None | None | None | None | None | None | None | None | None | ... | None | None | None | None | None | None | None | None | None | None |
49432 rows × 27 columns
Plot features¶
Inspired by https://snazzymaps.com/style/14889/flat-pale
In [13]:
Copied!
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()
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¶
In [14]:
Copied!
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
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
/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/site-packages/geopandas/array.py:1638: UserWarning: CRS not set for some of the concatenation inputs. Setting output's CRS as WGS 84 (the single non-null crs provided). return GeometryArray(data, crs=_get_common_crs(to_concat))
Finished operation in 0:00:22
Out[14]:
PosixPath('files/3b68f6ecc515eba6f588efa104d7eee92b450cf9c7e54f445afae421e604cf3f_098931824b94bfe02e01bc4987422a39ec47bd3f6924e5325ddae0846badafba_exploded.parquet')
Read those features using DuckDB¶
In [15]:
Copied!
import duckdb
connection = duckdb.connect()
connection.load_extension("parquet")
connection.load_extension("spatial")
features_relation = connection.read_parquet(str(reykjavik_features_gpq))
features_relation
import duckdb
connection = duckdb.connect()
connection.load_extension("parquet")
connection.load_extension("spatial")
features_relation = connection.read_parquet(str(reykjavik_features_gpq))
features_relation
Out[15]:
┌─────────────────┬───────────────┬─────────────┬───────────┬──────────────┬───────────┬──────────────┬──────────────────┬───────────────┬─────────┬─────────┬─────────────┬─────────────┬─────────────────┬─────────────┬──────────────┬───────────────────────────┬─────────┬─────────┬──────────┬────────────────────┬─────────────────────┬────────────────────────┬───────────┬──────────────────┬─────────┬───────────────┬───────────┬────────────────────────────────┐ │ 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/288037466 │ 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.9592124 64.1386272) │ │ node/288037479 │ 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.9633126 64.1389854) │ │ node/288037485 │ 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.9623437 64.140269) │ │ node/288037508 │ 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.964693 64.1407153) │ │ node/288037511 │ 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.9520576 64.1367153) │ │ node/288037537 │ 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.9587812 64.1362093) │ │ node/310242628 │ 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.8922379 64.1284641) │ │ node/310242658 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=pharmacy │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8871717 64.1282437) │ │ node/310242659 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=atm │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8869499 64.1285056) │ │ node/310242661 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ shop=shoes │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8872672 64.1281469) │ │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ · │ │ node/6486040159 │ 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.8606526 64.1297733) │ │ node/6486040168 │ 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.8569205 64.1280503) │ │ node/6486040169 │ 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.857719 64.1283394) │ │ node/6489455817 │ NULL │ NULL │ NULL │ amenity=cafe │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9435557 64.150968) │ │ node/6491107180 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ tourism=information │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8982235 64.1335319) │ │ node/6672834943 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ shop=laundry │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8757894 64.1459611) │ │ node/6672834947 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=toilets │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8755546 64.1459616) │ │ node/6679972738 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ highway=turning_circle │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8633952 64.1258772) │ │ node/6679972751 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ natural=tree │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.8626014 64.1254421) │ │ node/6926652910 │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ amenity=car_rental │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ NULL │ POINT (-21.9348811 64.1374936) │ ├─────────────────┴───────────────┴─────────────┴───────────┴──────────────┴───────────┴──────────────┴──────────────────┴───────────────┴─────────┴─────────┴─────────────┴─────────────┴─────────────────┴─────────────┴──────────────┴───────────────────────────┴─────────┴─────────┴──────────┴────────────────────┴─────────────────────┴────────────────────────┴───────────┴──────────────────┴─────────┴───────────────┴───────────┴────────────────────────────────┤ │ ? rows (>9999 rows, 20 shown) 29 columns │ └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Count all buildings¶
In [16]:
Copied!
features_relation.filter("buildings IS NOT NULL").count("feature_id")
features_relation.filter("buildings IS NOT NULL").count("feature_id")
Out[16]:
┌───────────────────┐ │ count(feature_id) │ │ int64 │ ├───────────────────┤ │ 25361 │ └───────────────────┘