[go: up one dir, main page]

0% found this document useful (0 votes)
10 views1 page

My Py

Uploaded by

kikarz360
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

My Py

Uploaded by

kikarz360
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import phonenumbers

from phonenumbers import geocoder


from phonenumbers import carrier

import folium
from opencage.geocoder import OpenCageGeocode
number=input("enter the phonenumber with country code:")
phoneNumber = phonenumber.parse(number)
Key="enter your Api"
yourLocation = geocoder.description_for_number(phoneNumber,"en")
print("Location : "+yourLocation)
yourServiceProvider = carrier.name_for_number(phoneNumber,"en")
print("service provider : "+yourServiceProvider)

# Using opencage to get the latitude and longitude of the location


geocoder = OpenCageGeocode(Key)
query = str(yourLocation)
results = geocoder.geocode(query)

# Assigning the latitude and longitude values to the lat and lng variables
lat = results[0]['geometry']['lat']
lng = results[0]['geometry']['lng']

# Getting the map for the given latitude and longitude


myMap = folium.Map(loction=[lat,lng],zoom_start = 9)
# Adding a Marker on the map to show the location name
folium.Marker([lat,lng],popup=yourLocation).add_to(myMap)

# save map to html file to open it and see the actual location in map format
myMap.save("Location.html")

You might also like