osm-tags-filter without specific tag #48
-
Hey @RaczeQ. Filtering by available tag works quite well quackosm DE.pbf --osm-tags-filter='{"addr:place":true}' but the combination of quackosm DE.pbf --osm-tags-filter='{"addr:place":true,"addr:street":false}'
does not seem to work. Expected output would be entities with tag |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @StephanGeorg, currently it doesn't work like that at all, but I can see where this could be a useful feature (and might be confusing). The filtering logic in QuackOSM is based on OSMnx, where only a You can see it here: This way was probably done to simplify Overpass queries generated by the OSMnx when querying a server. Here we can utilize negative values in the filter since we have the raw data available, but that would require some overhaul for generating SQL queries executed in DuckDB. I'll move it to a new issue for the future. For now, I'd probably use import duckdb
import quackosm as qosm
duckdb.load_extension('spatial')
# Load all the OSM elements from the PBF file with 'addr:place' and without 'addr:street'
features_df = duckdb.sql("""
SELECT
kind || '/' || id as feature_id
FROM
ST_READOSM('DE.pbf')
WHERE
tags IS NOT NULL
AND list_contains(map_keys(tags), 'addr:place')
AND NOT list_contains(map_keys(tags), 'addr:street')
""").to_df()
features_ids = list(features_df.feature_id)
# gpq_path = qosm.convert_pbf_to_gpq(file_paths="DE.pbf", filter_osm_ids=features_ids)
gdf = qosm.get_features_gdf(file_paths="DE.pbf", filter_osm_ids=features_ids) |
Beta Was this translation helpful? Give feedback.
This feature is now available since version
0.6.0
😉#49 #53