Answer the question
In order to leave comments, you need to log in
How to count the number of node and tag in each node in OpenStreetMap XML?
Coordinates given. How many node tags do not contain any tag tag (the first number in the answer), and how many contain at least one tag tag (the second number in the answer):
map2.osm = href=" https://www.openstreetmap.org /api/0.6/map?bbox=103... ">
My code:
from urllib.request import urlopen, urlretrieve
from bs4 import BeautifulSoup
xml = open('map2.osm', 'r', encoding='utf8') .read()
soup = BeautifulSoup(xml, 'lxml')
d = []
for node in soup.find_all('node'):
for i in node('tag'):
a = (node, i)
d.append (a)
print(d)
How to proceed, how to display exactly the number of tags for each node in the directory?
Thank you!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question