Answer the question
In order to leave comments, you need to log in
How to process geolocation on aiogram?
Local purpose: to process the geolocation submitted by the user, store the latitude and longitude in variables.
Just a goal: poll the user for location every minute (using location broadcast) and count the total mileage.
Can't get latitude and longitude. The option to do this through the button is not suitable, since in this case a point on the map is sent, and not a broadcast.
Location handler code:request_location=True
from aiogram.types import Message, Location
from aiogram import Bot, Dispatcher, executor
from config import admin_id
@dp.message_handler()
async def loc_handler(message: Location):
print(message)
print(message.longitude, message.latitude)
await bot.send_message(chat_id=admin_id, text="location is delivered")
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